java - Null Pointer Exception while using putExtra and getExtras -



java - Null Pointer Exception while using putExtra and getExtras -

i'm trying utilize putextra , getextras pass info in android game i'm writing (it's score). when i'm passing it, utilize code in 1 class set in information:

intent winscreen = new intent(context, winscreen.class); winscreen.putextra("score", "123");

and when i'm getting it, i'm using:

intent x=new intent(this, gamecall.class); bundle ebundle = x.getextras(); string score = (string) x.getextras().getserializable("score");

i'm trying test sample score right now, don't think setting value correctly problem. suggestion saw elsewhere why such null pointer occur. know understands "score" extra. stumped info beingness lost!

when utilize intent start new activity, must utilize getintent() specific instance of intent. using intent x=new intent(this, gamecall.class); won't work. seek next code:

intent x= this.getintent(); //in winscreen activity string score = (string) x.getstringextra("score");

java android

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -