title: Trying to pass URL from EditText to Fragment
body: <p>I am trying to pass a String value "url" to a fragment to display it in a web view. I keep getting the following error:</p>
  
  <p><strong>java.lang.NullPointerException</strong></p>
  
  <p>This is my code:</p>
  
  <pre><code>protected void goToTab1View() {
      if(mTabState != TAB1_STATE){
          mTabState = TAB1_STATE;
          Toast.makeText(getActivity(), "goToTabView1: " + url, Toast.LENGTH_SHORT).show();
          FragmentManager fm = getFragmentManager();
          if(fm!= null){
              //Perform fragment transaction
              FragmentTransaction ft = fm.beginTransaction();
              FragTab1 f = new FragTab1();
              f.setString(url);
              ft.replace(R.id.fragment_content, f);
              ft.commit();
          }
      }
  }
  </code></pre>
  
  <p>I presume I am not attaching the fragment correctly?? I am only new to fragments so I apologize if the question is obvious. Any help would be much appreciated.</p>
  
  <p>STACK TRACE: </p>
  
  <pre><code> 01-11 13:16:06.671: E/AndroidRuntime(23045): FATAL EXCEPTION: main
  01-11 13:16:06.671: E/AndroidRuntime(23045): java.lang.NullPointerException
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at android.widget.Toast.&lt;init&gt;(Toast.java:92)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at android.widget.Toast.makeText(Toast.java:238)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at com.example.tabdemo.FragTab1.setString(FragTab1.java:57)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at com.example.tabdemo.TabFragment.goToTab1View(TabFragment.java:60)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at com.example.tabdemo.MainActivity$1.onClick(MainActivity.java:34)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at android.view.View.performClick(View.java:4202)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at android.view.View$PerformClick.run(View.java:17340)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at android.os.Handler.handleCallback(Handler.java:725)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at android.os.Handler.dispatchMessage(Handler.java:92)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at android.os.Looper.loop(Looper.java:137)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at android.app.ActivityThread.main(ActivityThread.java:5039)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at java.lang.reflect.Method.invokeNative(Native Method)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at java.lang.reflect.Method.invoke(Method.java:511)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  01-11 13:16:06.671: E/AndroidRuntime(23045):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>