I've create an object class but it cannot work. any mistake of my code?

private void setName() {
// TODO Auto-generated method stub
getNameText();
for (int i=0; i<NUM_PLAYER; i++){
player.setPlayerName(name); // name is a String get from EditText by some code before
}
}

when I run the programme, it have the following error code:

05-23 09:24:35.115: E/AndroidRuntime(438): java.lang.NullPointerException
05-23 09:24:35.115: E/AndroidRuntime(438):  at hktsang56.android.mjhelper
.name_input.setName(name_input.java:81)

Which of the lines in your source code is line 81? Is it the line that says getNameText()? We need to see that method's definition, if that is the case, since I can't see any other problem (if 'name' were coming out null, then the error would be in setPlayerName() rather than in setName() - in fact it probably wouldn't generate an error in such a case).

Show us the code for getNameText(). You are possibly trying to access a control that you have not filled out correctly.




--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to