Note that there are some explanatory texts on larger screens.

plurals
  1. POMy app keeps crashing when opening on the emulator or android phone
    primarykey
    data
    text
    <pre><code>package com.ebonybutler.cexample3; import android.app.Activity; import android.content.Intent; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class Main extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Button b = (Button) findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent(Main.this, Second.class)); } }); } } </code></pre> <p>Every time I try to run it, the error </p> <blockquote> <p>'Sorry! the application example3 (processcom.ebonybutler.cexample3) has stopped unexpectedly. Please try again.'</p> </blockquote> <p>I can't figure out what keeps crashing it at launch because all of the java files seem fine or at least aren't any bugs. Please help! I've added the information from my logcat below but I'm having trying interpreting what its saying to me.</p> <pre><code>11-02 09:29:10.261: E/AndroidRuntime(276): FATAL EXCEPTION: main 11-02 09:29:10.261: E/AndroidRuntime(276): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ebonybutler.cexample3/com.ebonybutler.cexample3.Main}: java.lang.NullPointerException 11-02 09:29:10.261: E/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 11-02 09:29:10.261: E/AndroidRuntime(276): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 11-02 09:29:10.261: E/AndroidRuntime(276): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 11-02 09:29:10.261: E/AndroidRuntime(276): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 11-02 09:29:10.261: E/AndroidRuntime(276): at android.os.Handler.dispatchMessage(Handler.java:99) 11-02 09:29:10.261: E/AndroidRuntime(276): at android.os.Looper.loop(Looper.java:123) 11-02 09:29:10.261: E/AndroidRuntime(276): at android.app.ActivityThread.main(ActivityThread.java:4627) 11-02 09:29:10.261: E/AndroidRuntime(276): at java.lang.reflect.Method.invokeNative(Native Method) 11-02 09:29:10.261: E/AndroidRuntime(276): at java.lang.reflect.Method.invoke(Method.java:521) 11-02 09:29:10.261: E/AndroidRuntime(276): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 11-02 09:29:10.261: E/AndroidRuntime(276): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 11-02 09:29:10.261: E/AndroidRuntime(276): at dalvik.system.NativeStart.main(Native Method) 11-02 09:29:10.261: E/AndroidRuntime(276): Caused by: java.lang.NullPointerException 11-02 09:29:10.261: E/AndroidRuntime(276): at com.ebonybutler.cexample3.Main.onCreate(Main.java:21) 11-02 09:29:10.261: E/AndroidRuntime(276): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 11-02 09:29:10.261: E/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 11-02 09:29:10.261: E/AndroidRuntime(276): ... 11 more </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.
    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