title: How can I recreate a fragment?
body: <p>I'm using a widget called SwipeRefreshLayout, to refresh my fragment when someone pushes the view.</p>
  
  <p>To recreate the activity I have to use:</p>
  
  <pre><code>SwipeRefreshLayout mSwipeRefreshLayout;
  
  public static LobbyFragment newInstance() {
      return new LobbyFragment();
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      final View view = inflater.inflate(R.layout.fragment_lobby, container, false);
  
  
      receiver = new MySQLReceiver();
  
      rlLoading = (RelativeLayout) view.findViewById(R.id.rlLoading);
      gvLobby = (GridView) view.findViewById(R.id.gvLobby);
  
      updateList();
  
      mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.mSwipeRefreshLayout);
      mSwipeRefreshLayout.setColorSchemeResources(R.color.pDarkGreen, R.color.pDarskSlowGreen, R.color.pLightGreen, R.color.pFullLightGreen);
      mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
  
              getActivity().recreate();
          }
  
  
      });
  
  
      return view;
  
  }
  </code></pre>
  
  <p>But I don't want to recreate the full activity that contains the view pager, I would like to recreate the fragment. How can I do that?</p>