title: Problems with setText in a fragment in onCreateView(...)
body: <p>I know that people has asked similar questions but I still can't manage. I have a fragment and in the <code>onCreateView()</code> I have a string that I want to set equal to the text in my textView. However I can't make it work. Can somebody please give me a code example of how to write it?</p>
  
  <p>I have for instance tried this which makes the app crash:</p>
  
  <pre><code>TextView text = (TextView) getActivity().findViewById(R.id.sektion_name_detailed_view);
      text.setText("test");
  </code></pre>
  
  <p>Stacktrace:</p>
  
  <pre><code>06-12 23:02:59.926: W/dalvikvm(2402): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
  06-12 23:02:59.933: E/AndroidRuntime(2402): FATAL EXCEPTION: main
  06-12 23:02:59.933: E/AndroidRuntime(2402): java.lang.NullPointerException
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at se.Appsolut.student.DetailedViewSektionerFragment.onCreateView(DetailedViewSektionerFragment.java:21)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.os.Handler.handleCallback(Handler.java:615)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.os.Handler.dispatchMessage(Handler.java:92)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.os.Looper.loop(Looper.java:137)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at android.app.ActivityThread.main(ActivityThread.java:4745)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at java.lang.reflect.Method.invokeNative(Native Method)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at java.lang.reflect.Method.invoke(Method.java:511)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  06-12 23:02:59.933: E/AndroidRuntime(2402):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>