title: Pull SwipeRefreshLayout to refresh RecyclerView In Fragment in android but Not Working
body: <p>How can I refresh RecyclerView through SwipeRefreshLayout? I have searched a lot on google but its not working. Here is my code in fragment 
  I am fetching data from server through Jason Parsing and getting into array and setting array into my RecyclerView adapter. Data is showing fine but SwipeRefreshLayout not working.       </p>
  
  <pre><code>public class FirstFragment extends Fragment{
     public  RecyclerView recyclerView;
     public  SwipeRefreshLayout mswipeRefreshLayout;
    public static MyRecyclerAdapter searchAdapter;
      private static final String TAG = "FirstFragment";
      MyRecyclerAdapter myRecyclerAdapter;
      ArrayList&lt;DataStored&gt;dataStoredArrayList;
      private ParseDataClass mparser;
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          setHasOptionsMenu(true);
          View view=inflater.inflate(R.layout.first_fragment,null);
          recyclerView=(RecyclerView)view.findViewById(R.id.mFirstRecyclerview);
          recyclerView.setLayoutManager(new LinearLayoutManager(this.getActivity()));
          mswipeRefreshLayout = (SwipeRefreshLayout)view.findViewById(R.id.swipelayoutm);
          mparser = new ParseDataClass(getActivity());
          mparser.setOnDataRetrievalCallback(new OnDataRetrievalCallback() {
              @Override
              public void onDataRetrieval(ArrayList&lt;DataStored&gt; dataSet) {
                  dataStoredArrayList=dataSet;
                  myRecyclerAdapter=new MyRecyclerAdapter(getActivity(),dataStoredArrayList,mswipeRefreshLayout);
                  searchAdapter =myRecyclerAdapter;
                  recyclerView.setAdapter(myRecyclerAdapter);
              }
          });
          mparser.execute("http://192.168.3.10/fetchtext.php", "1");
           recyclerView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
              @Override
              public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
                  if (scrollX == 0) {
                      mswipeRefreshLayout.setEnabled(true);
                  } else mswipeRefreshLayout.setEnabled(false);
  
              }
          });
          mswipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
              @Override
              public void onRefresh() {
                  Refreshlist();
                  mswipeRefreshLayout.setRefreshing(false);
              }
          });
  
          return view;
      }
  
      private void Refreshlist() {
          new Handler().postDelayed(new Runnable() {
              @Override
              public void run() {
                  dataStoredArrayList.clear();
                  myRecyclerAdapter.notifyDataSetChanged();
                  mparser = new ParseDataClass(getActivity());
                  mparser.setOnDataRetrievalCallback(new OnDataRetrievalCallback() {
                      @Override
                      public void onDataRetrieval(ArrayList&lt;DataStored&gt; dataSet) {
                          dataStoredArrayList.addAll(dataSet);
                          myRecyclerAdapter.notifyDataSetChanged();
                      }
                  });
                  mparser.execute("http://192.168.3.10/fetchtext.php", "1");
  
              }
          }, 0);
      }
  
  
  }
  </code></pre>