title: Android Activity force closing when a new Intent is called
body: <p>This activity is supposed to call another activity, but instead it force closes the application.</p>
  
  <pre><code>package com.example.helloworld;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.TextView;
  
  public class Data extends Activity implements OnClickListener {
  
      Button start, startFor;
      EditText sendET;
      TextView gotAnswer;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.get);
          initialize();
      }
  
      private void initialize() {
          // TODO Auto-generated method stub
          start = (Button) findViewById(R.id.bSA);
          startFor = (Button) findViewById(R.id.bSAFR);
          sendET = (EditText) findViewById(R.id.etSend);
          gotAnswer = (TextView) findViewById(R.id.tvGot);
          start.setOnClickListener(this);
          startFor.setOnClickListener(this);
      }
  
      public void onClick(View v) {
          // TODO Auto-generated method stub
          switch (v.getId()) {
          case R.id.bSA:
              String bread = sendET.getText().toString();
              Bundle basket = new Bundle();
              basket.putString("key", bread);
  
              Intent a = new Intent(Data.this, OpenedClass.class);
              a.putExtras(basket); 
              startActivity(a);
              break;
  
          case R.id.bSAFR:
              Intent i = new Intent(Data.this, OpenedClass.class);
              startActivityForResult(i,0);
              break;
          }
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          // TODO Auto-generated method stub
          super.onActivityResult(requestCode, resultCode, data);
      }
  
  }
  </code></pre>
  
  <p>This is the other Activity that is to be called:</p>
  
  <pre><code>package com.example.helloworld;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.RadioGroup;
  import android.widget.RadioGroup.OnCheckedChangeListener;
  import android.widget.TextView;
  
  public class OpenedClass extends Activity implements OnClickListener,
          OnCheckedChangeListener {
  
      TextView question, test;
      Button returnData;
      RadioGroup selectionList;
      String gotBread, setData;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.send);
          initialize();
          Bundle gotBasket = getIntent().getExtras();
          gotBread = gotBasket.getString("key");
          question.setText(gotBread);
  
      }
  
      private void initialize() {
          // TODO Auto-generated method stub
          question = (TextView) findViewById(R.id.tvQuestions);
          test = (TextView) findViewById(R.id.tvText);
          returnData = (Button) findViewById(R.id.bResults);
          selectionList = (RadioGroup) findViewById(R.id.rgAnswers);
          returnData.setOnClickListener(this);
          selectionList.setOnCheckedChangeListener(this);
  
  
      }
  
      public void onClick(View v) {
          // TODO Auto-generated method stub
  
      }
  
      public void onCheckedChanged(RadioGroup arg0, int arg1) {
          // TODO Auto-generated method stub
          switch (arg1) {
          case R.id.rChoice1:
              setData="ABC";
              break;
          case R.id.rChoice2:
              setData="MNO";
              break;
          case R.id.rChoice3:
              setData="XYZ";
              break;
          }
          test.setText(setData);
      }
  
  }
  </code></pre>
  
  <p>This is my AndroidMaifest.xml file:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.helloworld"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="15" /&gt;
      &lt;uses-permission android:name="android.permission.SET_WALLPAPER"/&gt;
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".Splash"
              android:label="@string/title_activity_main" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/title_activity_main" &gt;
              &lt;intent-filter&gt;
  
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".Menu"
              android:label="@string/title_activity_main" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.example.helloworld.MENU" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".TextPlay" android:label="@string/title_activity_main" &gt;
          &lt;/activity&gt;
           &lt;activity
              android:name=".Email" android:label="@string/title_activity_main" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".Camera" android:label="@string/title_activity_main" android:screenOrientation="portrait" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".Data" android:label="@string/title_activity_main" &gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".OpenedClass" android:label="@string/title_activity_main" &gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Finally the LogCat logs:</p>
  
  <pre><code>10-17 10:36:56.423: D/AndroidRuntime(272): Shutting down VM
  10-17 10:36:56.423: W/dalvikvm(272): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
  10-17 10:36:56.453: E/AndroidRuntime(272): FATAL EXCEPTION: main
  10-17 10:36:56.453: E/AndroidRuntime(272): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.helloworld/com.example.helloworld.OpenedClass}: java.lang.NullPointerException
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.os.Handler.dispatchMessage(Handler.java:99)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.os.Looper.loop(Looper.java:123)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at java.lang.reflect.Method.invokeNative(Native Method)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at java.lang.reflect.Method.invoke(Method.java:521)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at dalvik.system.NativeStart.main(Native Method)
  10-17 10:36:56.453: E/AndroidRuntime(272): Caused by: java.lang.NullPointerException
  10-17 10:36:56.453: E/AndroidRuntime(272):  at com.example.helloworld.OpenedClass.initialize(OpenedClass.java:38)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at com.example.helloworld.OpenedClass.onCreate(OpenedClass.java:25)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  10-17 10:36:56.453: E/AndroidRuntime(272):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  10-17 10:36:56.453: E/AndroidRuntime(272):  ... 11 more
  10-17 10:36:59.083: I/Process(272): Sending signal. PID: 272 SIG: 9
  </code></pre>
  
  <p>The problem is that the application compiles without errors but crashes when I try to invoke the activity. I'm not sure where the problem is. Is it the manifest?</p>