Thank you,Geoffrey !

Exactly, I change to

AnswerTextView[0] = (TextView)findViewById(R.id.cau_1_answer_grammar);

it works well.

But all my AnswerList displays 0 while I set all *char*, please see brief
code, I think the last instruction has problem, but don't know how to fix :

    char[]     AnswerList = new char[10];

    protected void onCreate(Bundle icicle){
        super.onCreate(icicle);
        setContentView(R.layout.result_grammar);
        setAnswerList();
        setAnswerListTextView();
    }
      private void setAnswerList() {

           //assign AnswerList[10]

           AnswerList[0] = Cau_1_grammar.getCau_1_Answer();
           AnswerList[1] = Cau_2_grammar.getCau_2_Answer();
           AnswerList[2] = Cau_3_grammar.getCau_3_Answer();
           AnswerList[3] = Cau_4_grammar.getCau_4_Answer();
           AnswerList[4] = Cau_5_grammar.getCau_5_Answer();
           AnswerList[5] = Cau_6_grammar.getCau_6_Answer();
           AnswerList[6] = Cau_7_grammar.getCau_7_Answer();
           AnswerList[7] = Cau_8_grammar.getCau_8_Answer();
           AnswerList[8] = Cau_9_grammar.getCau_9_Answer();
           AnswerList[9] = Cau_10_grammar.getCau_10_Answer();
   }
       protected void setAnswerListTextView() {
            // Identify TextView on "Your answer:" column


AnswerTextView[0]=(TextView)this.findViewById(R.id.cau_1_answer_grammar);

AnswerTextView[1]=(TextView)this.findViewById(R.id.cau_2_answer_grammar);

AnswerTextView[2]=(TextView)this.findViewById(R.id.cau_3_answer_grammar);

AnswerTextView[3]=(TextView)this.findViewById(R.id.cau_4_answer_grammar);

AnswerTextView[4]=(TextView)this.findViewById(R.id.cau_5_answer_grammar);

AnswerTextView[5]=(TextView)this.findViewById(R.id.cau_6_answer_grammar);

AnswerTextView[6]=(TextView)this.findViewById(R.id.cau_7_answer_grammar);

AnswerTextView[7]=(TextView)this.findViewById(R.id.cau_8_answer_grammar);

AnswerTextView[8]=(TextView)this.findViewById(R.id.cau_9_answer_grammar);

AnswerTextView[9]=(TextView)this.findViewById(R.id.cau_10_answer_grammar);

  // Display answer in "Your answer:" column
        for(int i=0;i<=9;i++){
            AnswerTextView[i].setText(Integer.toString(AnswerList[i]));
// *Does
this drive all char to 0*
        }
}






On Wed, Apr 2, 2008 at 3:53 AM, Geoffrey <[EMAIL PROTECTED]>
wrote:

>
> Not sure if my last message came through. But I think the problem you
> have is as follows...
>
> change
>
> AnswerTextView[0].findViewById(R.id.cau_1_answer_grammar);
>
> to
>
> AnswerTextView[0] = findViewById(R.id.cau_1_answer_grammar);
>
>
> ..Geoffrey
>
>
> On Apr 1, 1:27 pm, "LE THANH TUNG" <[EMAIL PROTECTED]> wrote:
> > I have run many times. It's a long and complicated code with no error on
> > eclipse editor. But the result is null pointer exception. I have tried
> but
> > not found the exact error. I just doubt if these method is right with
> > Android library.
> >
> > Thanks.
> >
> >
> >
> > On Wed, Apr 2, 2008 at 3:14 AM, tim jones <[EMAIL PROTECTED]> wrote:
> >
> > > Why can't you run it yourself to see if it has problems, then ask us
> > > why it is not working properly?
> >
> > > On Tue, Apr 1, 2008 at 2:50 PM, LE THANH TUNG <[EMAIL PROTECTED]
> >
> > > wrote:
> > > > Does my following short code have problem ?
> >
> > > >         TextView[]        AnswerTextView = new TextView[10];
> >
> > > >     protected void onCreate(Bundle icicle) {
> >
> > > >         ....
> > > >         AnswerTextView[0].findViewById(R.id.cau_1_answer_grammar);
> > > >         ....
> > > >         AnswerTextView[9].findViewById(R.id.cau_10_answer_grammar);
> > > >        setAnswerListTextView()
> >
> > > >       }
> > > >        protected void setAnswerListTextView() {
> >
> > > >         // Display answer in "Your answer:" column
> >
> > > >         for(int i=0;i<=9;i++){
> > > >             AnswerTextView[i].setText(AnswerList[i]); //is it
> possible ?
> >
> > > >         }
> > > >     }
> >
> > > > Please correct if any, thanks !
> >
> > > > --
> > > > Many thanks and regards
> > > > LÊ THANH TÙNG
> > > > Da Nang, Vietnam
> >
> > --
> > Many thanks and regards
> > LÊ THANH TÙNG
> > Da Nang, Vietnam
> >
>


-- 
Many thanks and regards
LÊ THANH TÙNG
Da Nang, Vietnam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to