title: Getting arguments from a bundle
body: <p>I'm trying to pass arguments from my Activity to a Fragment and I'm using this code: </p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_detail);
  
          String message = getIntent().getStringExtra(Intent.EXTRA_TEXT);
  
          DetailActivityFragment fragment = new DetailActivityFragment();
  
          Bundle bundle = new Bundle();
          bundle.putString(INTENT_EXTRA, message);
  
          fragment.setArguments(bundle);
      }
  </code></pre>
  
  <p>I'm getting the value of the message variable through an Intent Extra and that works fine, so far.<br>
  Then I'm passing it as an argument to my fragment but then, when I call <code>getArguments()</code> from that specific Fragment it returns a null Bundle.<br>
  Does anybody have a solution to this?</p>
  
  <pre><code>@Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          Bundle bundle = getArguments();
  
          if (bundle != null &amp;&amp; bundle.containsKey(DetailActivity.INTENT_EXTRA)) {
              forecast = bundle.getString(DetailActivity.INTENT_EXTRA);
          } else if (bundle == null) {
              Toast.makeText(getActivity(), "Error", Toast.LENGTH_LONG).show();
          }
  
      }
  </code></pre>
  
  <p>The upper method displays a Toast message "Error" when I run the app...</p>