Answer the question
In order to leave comments, you need to log in
How to deal with this java.lang.NullPointerException when calling VideosActivity?
This is the error that occurs
05-30 13:25:38.584 12963-12963/com.wasdclub.android E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.wasdclub.android, PID: 12963
java.lang.NullPointerException
at android.content.ComponentName.<init>(ComponentName.java:77)
at android.content.Intent.<init>(Intent.java:4398)
at com.sample.drawer.MainActivity$1.onClick(MainActivity.java:53)
at android.view.View.performClick(View.java:4640)
at android.view.View$PerformClick.run(View.java:19431)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5598)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Button myButton = (Button) findViewById(R.id.button);
myButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(context, VideosActivity.class);
context.startActivity(intent);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question