Re: [android-developers] Create an object class but error

2012-05-24 Thread HK Tsang
Daniel, Thank you for your kindly recommandation. Anyway, I've find what's the problem there and solved. Thank you very much. HK On Thu, May 24, 2012 at 5:29 PM, Daniel Drozdzewski < daniel.drozdzew...@gmail.com> wrote: > HK, > > I am sorry you feel this way - and don't worry, you have not dis

Re: [android-developers] Create an object class but error

2012-05-24 Thread Daniel Drozdzewski
HK, I am sorry you feel this way - and don't worry, you have not disturbed me. I think that you would be much better off, learning Java first, outside of Android or any other platform. Simply start some tutorial, going through nuances of Java. Problems you are having are very easy to fix, once y

Re: [android-developers] Create an object class but error

2012-05-23 Thread HK Tsang
Yes you are right. Acturally I'm learning both together right now. I just can learn it by my-self and find some exsample to study on web. No one can teach me arround me. Therefore I just can ask something that I don't understand in here. I know that my knowledge is too a little. But I hope someone

Re: [android-developers] Create an object class but error

2012-05-23 Thread Daniel Drozdzewski
oh dear, i suggest learning java first. D. On Thursday, 24 May 2012, HK Tsang wrote: > I've passed the code when I add player = new MyPlayer() in onCreate. but next step, I change it to array: > > MyPlayer[] players; > > . > . > . > . > onCreate > players = new MyPlayer[4]; > > > then it al

Re: [android-developers] Create an object class but error

2012-05-23 Thread HK Tsang
I've passed the code when I add player = new MyPlayer() in onCreate. but next step, I change it to array: MyPlayer[] players; . . . . onCreate players = new MyPlayer[4]; then it also NPE. why it pass when I use single player but use array do not pass? == full code in main activity pack

Re: [android-developers] Create an object class but error

2012-05-23 Thread Daniel Drozdzewski
Jason name == null would not cause NPE, as it is simple assignment to a member variable in MyPlayer class. If there was anything else within setName() that caused NPE, we could see it on the top of the stacktrace. The cause is that *player* reference in *player_input.setName()* is null. The way

Re: [android-developers] Create an object class but error

2012-05-23 Thread Jason Teagle
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; iplayer.setPlayerName(name); // name is a String get from EditText by some code before } } when I run the programme, it have the

[android-developers] Create an object class but error

2012-05-23 Thread hktsang
Dear all, I've create an object class but it cannot work. any mistake of my code? Code in class: * public class MyPlayer { private int winCount = 0; private String myName = ""; private int myMoney = 0; private int loseCount = 0;