java.lang.NullPointerException: Attempt to invoke virtual method on a null object reference [duplicate]

java.lang.NullPointerException: Attempt to invoke virtual method on a null object reference [duplicate]

Your app is crashing at:

welcomePlayer.setText("Welcome Back, " + String.valueOf(mPlayer.getName(this)) + " !");

because mPlayer=null.

You forgot to initialize Player mPlayer in your PlayGame Activity.

mPlayer = new Player(context,"");

java.lang.NullPointerException: Attempt to invoke virtual method on a null object reference [duplicate]

java.lang.NullPointerException: Attempt to invoke virtual method on a null object reference [duplicate]

Leave a Reply

Your email address will not be published.