title: Headless fragment with arguments, how to use Fragment.newInstance?
body: <p>I've been working through 3 different tutorials to get a headless fragment to open sockets and stay open through lifecycle changes. I think I'm really close but there is one final element that escapes me. The guts of the fragment for opening the sockets and threads is based on a class that works fairly well so I'm not too concerned with that part, at least for now. Here is the relevant parts of the fragment, the rest left out to make it less torturous to read. What I'm trying to do is pass in a p2p Group Owner's IP and port. (no problems with that)</p>
  
  <pre><code>public class ConnectionFragment extends Fragment {
  
      private InetAddress mGoAddress;
      private int mGoPort;
      private Client mClient;
      private static final String TAG = "Connection";
      private static final String CLIENT_TAG = "Client";
      private Server mServer;
      private Socket mSocket;
      private ConnectionFragmentListener mListener;
  
  
      public static ConnectionFragment newInstance(InetAddress address, int port){
          Bundle bundle = new Bundle();
          bundle.putSerializable("GoAddress", address);
          bundle.putInt("GoPort", port);
          ConnectionFragment fragment = new ConnectionFragment();
          fragment.setArguments(bundle);
  
          return fragment;
      }
  
  
      private void readBundle(Bundle bundle){
          if (bundle != null){
              mGoAddress = (InetAddress)bundle.getSerializable("GoAddress");
              mGoPort = bundle.getInt("GoPort");
          }
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setRetainInstance(true);
          readBundle(getArguments());
          mGoAddress = (InetAddress) getArguments().getSerializable("GoAddress");
          mGoPort = getArguments().getInt("GoPort");
  
          mServer = new Server();
  
      }
  </code></pre>
  
  <p>Then in my activity I do this, giving it the Group Owner IP and port.</p>
  
  <pre><code>mConnection = ConnectionFragment.newInstance(goInetAddress, prefixedPort);
  </code></pre>
  
  <p>My question is, what do I do next to run mConnection?
  Thank you.</p>