I have error messages in an Android app, this is a Nullpointerexception in onCreate () in Activity. Invalid code: getIntent (). getExtras (). getStringExtra ("name"). (Nullpointerexception)
This means getExtras () is null somehow. I am sure that I set an intention additionally in every place that I create. I can not recreate it on the emulator on the device. I think this happened on my real device (but not during debugging) after I tried to open the application again, meanwhile Android probably killed the process and restored activity again. But shouldn't there be intentions left even in this scenario?
I tried to kill the process on the emulator, onCreate was called again, and getExtras () returned the correct value.
I replaced the getIntent () code. getStringExtra (). What difference, moreover, would not throw a nullpointerexception, but would still set String to null. Is there any other difference?
What could be the reason for this?
source share