title: getActivity() returns null in Fragment function
body: <p>I have a fragment (F1) with a public method like this</p>
  <pre><code>public void asd() {
      if (getActivity() == null) {
          Log.d(&quot;yes&quot;,&quot;it is null&quot;);
      }
  }
  </code></pre>
  <p>and yes when I call it (from the Activity), it is null...</p>
  <pre><code>FragmentTransaction transaction1 = getSupportFragmentManager().beginTransaction();
  F1 f1 = new F1();
  transaction1.replace(R.id.upperPart, f1);
  transaction1.commit();
  f1.asd();
  </code></pre>
  <p>It must be something that I am doing very wrong, but I don't know what that is.</p>