title: How to limit this swipe refresh if its only at top?
body: <p>This is my code which I used to make my data fetched from my data base in form of a list.But it is refreshing at all time when scroll down after a scrolled up for an instant . I need to make the refresh avail only when it is at top.</p>
  
  <pre><code> import android.content.Context;
   import android.content.Intent;
   import android.os.Bundle;
   import android.support.v4.app.Fragment;
   import android.support.v4.widget.SwipeRefreshLayout;
   import android.view.LayoutInflater;
   import android.view.View;
   import android.view.ViewGroup;
   import android.widget.AdapterView;
   import android.widget.ListView;
   import android.widget.ProgressBar;
   import android.widget.TextView;
  
   import com.shuan.Project.R;
   import com.shuan.Project.Utils.Common;
   import com.shuan.Project.adapter.ConnectAdapter;
   import com.shuan.Project.asyncTasks.GetHome;
   import com.shuan.Project.asyncTasks.GetPost;
   import com.shuan.Project.employer.PostViewActivity;
   import com.shuan.Project.list.Sample;
  
   import java.util.ArrayList;
   import java.util.HashMap;
  
  public class OffersFragment extends Fragment {
  
  
     private ArrayList&lt;Sample&gt; list;
     private ConnectAdapter adapter;
  private ListView listView;
  private HashMap&lt;String, String&gt; cData;
  private Common mApp;
  private Context mContext;
  private ProgressBar progressBar;
  private SwipeRefreshLayout swipe;
  
  
  public OffersFragment() {
      // Required empty public constructor
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
  
      mContext=getActivity();
      mApp= (Common) mContext.getApplicationContext();
      View view = inflater.inflate(R.layout.fragment_employer_home, container, false);
  
      swipe = (SwipeRefreshLayout) view.findViewById(R.id.swipe);
      listView = (ListView) view.findViewById(R.id.post);
      progressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
  
      list = new ArrayList&lt;Sample&gt;();
  
      new GetPost(getActivity(), listView, progressBar, mApp.getPreference().getString(Common.u_id,""),"all", swipe).execute();
  
  
      listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
              TextView txt = (TextView) view.findViewById(R.id.jId);
              TextView txt1= (TextView) view.findViewById(R.id.frm_id);
              Intent in=new Intent(getActivity(),PostViewActivity.class);
              in.putExtra("jId",txt.getText().toString());
              in.putExtra("frmId",txt1.getText().toString());
              in.putExtra("apply","no");
              startActivity(in);
          }
      });
      swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
              new GetHome(getActivity(), listView, progressBar, mApp.getPreference().getString(Common.u_id, ""), "all",swipe).execute();
          }
      });
  
      return view;
     }
  
   }
  </code></pre>
  
  <p>my xml file </p>
  
  <pre><code>   &lt;android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/swipe"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.shuan.Project.fragment.ConnectionFragment"&gt;
  
  
      &lt;ProgressBar
          android:id="@+id/progress_bar"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true" /&gt;
  
      &lt;ListView
          android:id="@+id/post"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:divider="@null"
          android:visibility="gone" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>