+ 1
Resolve Java nullPointer exception
In my app i use Intent for start an activity, but the exception say this: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content. Intent.setClass(android.content.Context, java.lang.Class)' on a null object reference and this is the code: Intent i = new Intent(getApplicationContext(), MyActivity.class); startActivity(i); How can i do?
1 Odpowiedź
+ 10
Try
Intent i = new Intent(CurrentActivity.this, MyActivity.class);
startActivity(i);
Where current Activity is the Activity you are trying to move from