Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to start activity
    primarykey
    data
    text
    <p>I pass a bundle through an intent and start an activity, but it is not executing. The exception in the log is </p> <pre><code>09-25 21:11:44.514: E/AndroidRuntime(426): FATAL EXCEPTION: main 09-25 21:11:44.514: E/AndroidRuntime(426): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.x.y.httpcommunicationhelper2/com.x.y..httpcommunicationhelper2.logout}: java.lang.NullPointerException. </code></pre> <p>Could you point out the error. Could you help out ?The code is:</p> <pre><code>//Intent part if (result != null) { Intent tokenIntent = new Intent(mContext, tokenActivity.class); Bundle bundle = new Bundle(); bundle.putString("responsedata", result.substring(result.indexOf("=") + 1, result.length())); tokenIntent.putExtras(bundle); startActivity(tokenIntent); //logout class public class logout extends Activity { TextView logouttext; Bundle bundle2; Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main3); mContext = this; logouttext = (TextView) findViewById(R.id.tvlogout); bundle2 = getIntent().getExtras(); Log.i("logout - ats token", bundle2.getString("responsedata")); URLconnector ss = new URLconnector(); ss.execute("url"); } private class URLconnector extends AsyncTask &lt; String, Void, String &gt; { @Override protected String doInBackground(String...urls) { String response = ""; for (String url: urls) { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); try { List &lt; NameValuePair &gt; postParameters = new ArrayList &lt; NameValuePair &gt; (); postParameters.add(new BasicNameValuePair("appID", "hjbhjbh")); postParameters.add(new BasicNameValuePair("atsToken", bundle2.getString("responsedata"))); Log.i("logout - ats token", bundle2.getString("responsedata")); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity( postParameters); httppost.setEntity(formEntity); HttpResponse logoutresp = httpclient.execute(httppost); Log.i("Logout response ", logoutresp.toString()); </code></pre> <p>The error log is :</p> <pre><code>09-25 21:11:44.514: E/AndroidRuntime(426): FATAL EXCEPTION: main 09-25 21:11:44.514: E/AndroidRuntime(426): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.x.y.httpcommunicationhelper2/com.x.y..httpcommunicationhelper2.logout}: java.lang.NullPointerException 09-25 21:11:44.514: E/AndroidRuntime(426): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 09-25 21:11:44.514: E/AndroidRuntime(426): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 09-25 21:11:44.514: E/AndroidRuntime(426): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 09-25 21:11:44.514: E/AndroidRuntime(426): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 09-25 21:11:44.514: E/AndroidRuntime(426): at android.os.Handler.dispatchMessage(Handler.java:99) 09-25 21:11:44.514: E/AndroidRuntime(426): at android.os.Looper.loop(Looper.java:123) 09-25 21:11:44.514: E/AndroidRuntime(426): at android.app.ActivityThread.main(ActivityThread.java:3683) 09-25 21:11:44.514: E/AndroidRuntime(426): at java.lang.reflect.Method.invokeNative(Native Method) 09-25 21:11:44.514: E/AndroidRuntime(426): at java.lang.reflect.Method.invoke(Method.java:507) 09-25 21:11:44.514: E/AndroidRuntime(426): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 09-25 21:11:44.514: E/AndroidRuntime(426): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 09-25 21:11:44.514: E/AndroidRuntime(426): at dalvik.system.NativeStart.main(Native Method) 09-25 21:11:44.514: E/AndroidRuntime(426): Caused by: java.lang.NullPointerException 09-25 21:11:44.514: E/AndroidRuntime(426): at com.x.y.httpcommunicationhelper2.logout.onCreate(logout.java:52) 09-25 21:11:44.514: E/AndroidRuntime(426): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 09-25 21:11:44.514: E/AndroidRuntime(426): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload