Issue
It's better to post pictures to show what exactly is going on, okay? The first image shows an object of the Intent class called senderIntent, which will send it to a class called "Resultado". The senderIntent (which is an object of the Intent class) sends the value of the variable email, to another variable also called email:
In the next image, it shows that I created an object of the Intent class called receiverIntent:
Then I created an object of the Bundle class that receives the receiverIntent's getextras() method. The problem is that the NullPointer Exception error is happening in the line of code: Bundle receiverBundle = receiverIntent.getExtras();
Please what to do to fix it?
Solution
Generally speaking, do not call Activity
methods from a field initializer. Move your getIntent()
and getExtras()
calls to be inside of onCreate()
, after the call to super.onCreate()
.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.