For some reason, my app crashes on the tablet I'm testing on, but not on the phone. I'm not sure what is causing this. It happens in different parts of the app, but it's always when moving from one screen to another.
Here is the code that seems to crash the app:
public void About(View view)
{
Intent i = new Intent();
i.setClassName("com.example","com.example.timestableseasy.About");
startActivity(i);
}
about.java
public class About extends Activity
{
TextView home;
@Override
public void onBackPressed() {
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
home = (TextView) findViewById(R.id.home);
home.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Log.d("Exercise", "button clicked");
Intent i = new Intent();
i.setClassName("com.example","com.example.timestableseasy.Menu2");
startActivity(i);
}
});
}
}
and here is the logcat:
06-16 16:20:59.465: D/AndroidRuntime(6281): Shutting down VM
06-16 16:20:59.465: W/dalvikvm(6281): threadid=1: thread exiting with uncaught exception (group=0x412f2930)
06-16 16:20:59.473: E/AndroidRuntime(6281): FATAL EXCEPTION: main
06-16 16:20:59.473: E/AndroidRuntime(6281): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.timestableseasy.About}: java.lang.NullPointerException
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2245)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.app.ActivityThread.access$700(ActivityThread.java:150)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.os.Handler.dispatchMessage(Handler.java:99)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.os.Looper.loop(Looper.java:175)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.app.ActivityThread.main(ActivityThread.java:5279)
06-16 16:20:59.473: E/AndroidRuntime(6281): at java.lang.reflect.Method.invokeNative(Native Method)
06-16 16:20:59.473: E/AndroidRuntime(6281): at java.lang.reflect.Method.invoke(Method.java:511)
06-16 16:20:59.473: E/AndroidRuntime(6281): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
06-16 16:20:59.473: E/AndroidRuntime(6281): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
06-16 16:20:59.473: E/AndroidRuntime(6281): at dalvik.system.NativeStart.main(Native Method)
06-16 16:20:59.473: E/AndroidRuntime(6281): Caused by: java.lang.NullPointerException
06-16 16:20:59.473: E/AndroidRuntime(6281): at com.example.timestableseasy.About.onCreate(About.java:25)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.app.Activity.performCreate(Activity.java:5283)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
06-16 16:20:59.473: E/AndroidRuntime(6281): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
06-16 16:20:59.473: E/AndroidRuntime(6281): ... 11 more
This worked before, but stopped working in the last week for some reason.
EDIT: I have eliminated the possibility of there being an error in the large layout file - forcing the application to load the normal version by deleting the large file, it still shows the same error when pressing the button to go to the about screen.