I can send you my application folder if you want to !

On Fri, Apr 4, 2008 at 2:57 PM, LE THANH TUNG <[EMAIL PROTECTED]>
wrote:

> Thank you Dan. It's nice. I just try not to bother you.
>
> Please see Resume_reading.java (I don't post grammar.java in another
> package because it runs well)
>
> *Resume.java :*
>
> package com.google.tung.englishtest.reading;
>
> import com.google.tung.englishtest.R;
> import android.app.Activity;
> import android.content.Intent;
> import android.os.Bundle;
> import android.view.View;
> import android.view.View.OnClickListener;
> import android.widget.Button;
> import android.widget.TextView;
>
> public class Resume_reading extends Activity {
>
>     static char[]     AnswerList = new char[10];
>     char[]            RightAnswerList = new
> char[]{'a','c','c','a','b','c','a','b','c','b'};
>     TextView[]        AnswerTextView = new TextView[10];
>     TextView          ResultTextView;
>     TextView          Right_Answer_Number;
>
>     protected void onCreate(Bundle icicle)
>     {
>         super.onCreate(icicle);
>         setContentView(R.layout.result_reading);
>
>         setAnswerList();
>         setAnswerListTextView();
>
>         ResultTextView =
> (TextView)this.findViewById(R.id.result_reading_passed);
>         Right_Answer_Number =
> (TextView)this.findViewById(R.id.number_right_answer_reading);
>
>         setResult();
>
>         Button ReviewButton =
> (Button)findViewById(R.id.button_review_reading);
>         ReviewButton.setOnClickListener(reviewClick);
>         Button takeAnotherPartButton =
> (Button)findViewById(R.id.take_another_part_reading);
>         takeAnotherPartButton.setOnClickListener(takeAnotherPart);
>
>    }
>
>    private void setAnswerList() {
>
>            //assign AnswerList[10]
>
>            AnswerList[0] = Cau_1_reading.getCau_1_Answer();
>            AnswerList[1] = Cau_2_reading.getCau_2_Answer();
>            AnswerList[2] = Cau_3_reading.getCau_3_Answer();
>            AnswerList[3] = Cau_4_reading.getCau_4_Answer();
>            AnswerList[4] = Cau_5_reading.getCau_5_Answer();
>            AnswerList[5] = Cau_6_reading.getCau_6_Answer();
>            AnswerList[6] = Cau_7_reading.getCau_7_Answer();
>            AnswerList[7] = Cau_8_reading.getCau_8_Answer();
>            AnswerList[8] = Cau_9_reading.getCau_9_Answer();
>            AnswerList[9] = Cau_10_reading.getCau_10_Answer();
>
>     }
>
>     private void setAnswerListTextView() {
>         // Identify TextView on "Your answer:" column
>
>
> AnswerTextView[0]=(TextView)this.findViewById(R.id.cau_1_answer_reading);
>
> AnswerTextView[1]=(TextView)this.findViewById(R.id.cau_2_answer_reading);
>
> AnswerTextView[2]=(TextView)this.findViewById(R.id.cau_3_answer_reading);
>
> AnswerTextView[3]=(TextView)this.findViewById(R.id.cau_4_answer_reading);
>
> AnswerTextView[4]=(TextView)this.findViewById(R.id.cau_5_answer_reading);
>
> AnswerTextView[5]=(TextView)this.findViewById(R.id.cau_6_answer_reading);
>
> AnswerTextView[6]=(TextView)this.findViewById(R.id.cau_7_answer_reading);
>
> AnswerTextView[7]=(TextView)this.findViewById(R.id.cau_8_answer_reading);
>
> AnswerTextView[8]=(TextView)this.findViewById(R.id.cau_9_answer_reading);
>
> AnswerTextView[9]=(TextView)this.findViewById(R.id.cau_10_answer_reading);
>
>     // Display answer in "Your answer:" column
>     for(int i=0;i<=9;i++){
>         AnswerTextView[i].setText(Character.toString(AnswerList[i]));
>     }
> }
>
>     private void setResult() {
>         //Display result : Passed or not Passed
>          int               Result = 0;
>           for(int i=0;i<=9;i++){
>              if (AnswerList[i] == RightAnswerList[i]) {Result++;}
>          }
>
>          if (Result>=5) {ResultTextView.setText("Passed");}
>          else {ResultTextView.setText("Not passed");};
>          Right_Answer_Number.setText(Integer.toString(Result));
>
>     }
>
>    private OnClickListener reviewClick = new OnClickListener()
>     {
>        public void onClick(View v)
>         {
>      //        Here we start the next activity
>             Intent intent = new Intent();
>             intent.setClass(Resume_reading.this, Cau_1_reading.class);
>             startActivity(intent);
>             finish();
>
>         }
>     };
>     private OnClickListener takeAnotherPart = new OnClickListener()
>     {
>         public void onClick(View v)
>         {
>             // Here we start the next activity
>             Intent intent = new Intent();
>
> intent.setClass(Resume_reading.this,com.google.tung.englishtest.Introduction.class);
>             startActivity(intent);
>             finish();
>
>         }
>     };
>
>     }
>
>
> *result_reading.xml* :
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <RelativeLayout
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="vertical"
> >
> <TableLayout
> id="@+id/table_result_1_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="vertical"
> >
> <TableRow
> id="@+id/result_head_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> id="@+id/result_head_question_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="Question :"
> >
> </TextView>
> <TextView
> id="@+id/result_head_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="Your answer :"
> >
> </TextView>
> <TextView
> id="@+id/result_head_right_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="Right answer :"
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_1_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="1"
> >
> </TextView>
> <TextView
> id="@+id/cau_1_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_1_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="a"
>
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_2_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="2"
> >
> </TextView>
> <TextView
> id="@+id/cau_2_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_2_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="c"
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_3_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="3"
> >
> </TextView>
> <TextView
> id="@+id/cau_3_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_3_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="c"
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_4_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="4"
> >
> </TextView>
> <TextView
> id="@+id/cau_4_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_4_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="a"
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_5_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="5"
> >
> </TextView>
> <TextView
> id="@+id/cau_5_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_5_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="b"
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_6_row_reading"
> android:layout_width="275px"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="6"
> >
> </TextView>
> <TextView
> id="@+id/cau_6_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_6_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="c"
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_7_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="7"
> >
> </TextView>
> <TextView
> id="@+id/cau_7_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_7_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="a"
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_8_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="8"
> >
> </TextView>
> <TextView
> id="@+id/cau_8_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_8_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="b"
>
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_9_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="9"
> >
> </TextView>
> <TextView
> id="@+id/cau_9_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_9_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="c"
> >
> </TextView>
> </TableRow>
> <TableRow
> id="@+id/cau_10_row_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="10"
> >
> </TextView>
> <TextView
> id="cau_10_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> <TextView
> id="@+id/cau_10_result_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="b"
> >
> </TextView>
> </TableRow>
> </TableLayout>
> <TableLayout
> id="@+id/table_result_2_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:layout_below="@+id/table_result_1_reading"
> >
> <TableRow
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="Number of right answers :"
> >
> </TextView>
> <TextView
> id="@+id/number_right_answer_reading"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> </TableRow>
> <TableRow
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <TextView
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> android:text="Result :"
> >
> </TextView>
> <TextView
> id="@+id/result_reading_passed"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:padding="3dip"
> >
> </TextView>
> </TableRow>
> </TableLayout>
> <TableLayout
> id="@+id/table_result_3_reading"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="vertical"
> android:layout_below="@+id/table_result_2_reading"
> >
> <TableRow
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> xmlns:android="http://schemas.android.com/apk/res/android";
> android:orientation="horizontal"
> >
> <Button
> id="@+id/button_review_reading"
> android:layout_width="wrap_content"
> android:layout_height="30px"
> android:text="Review in detail"
>
> >
> </Button>
> <Button
> id="@+id/take_another_part_reading"
> android:layout_width="wrap_content"
> android:layout_height="30px"
> android:text="Take another part"
>
> >
> </Button>
> </TableRow>
> </TableLayout>
> </RelativeLayout>
>
> By the way, last time you taught me to use the back button (available on
> the phone) to return to the previous page. Could you tell me precisely where
> to implement the onClickListener, there is not a widget to implement for
> this functionality ? I tried your last instruction but it doesn't work
>
> Please let me know if you have any question !
>
> Tung.
>
>
> On Fri, Apr 4, 2008 at 2:45 PM, Dan U. <[EMAIL PROTECTED]> wrote:
>
> >
> > Without seeing the code, it's quite difficult to find the problem.
> >
> > On Apr 4, 12:38 am, "LE THANH TUNG" <[EMAIL PROTECTED]> wrote:
> > > Hi
> > >
> > > I tried to fix my null pointer exception 3 days but I don't success,
> > please
> > > help me.
> > >
> > > I have 2 classes Resume_grammar.java and Resume_reading_java in 2
> > differrent
> > > packages, same code but different widget id. The Resume_grammar runs
> > well
> > > but the Resume_reading get Null Pointer Exception. All variables are
> > private
> > > and default, no inheritance. All id are unique...
> > >
> > > Is there any possible coming from Android ?, or please help me if you
> > can
> > > guess a cause for me to check. I spent 3 whole days but not find the
> > cause.
> > >
> > > --
> > > 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