Q:

app cannot run after adding some listeners for three buttons

I just started studying Androdid programming and have come up with some problems. I was trying to implement an app with a textview and three buttons(true_button, false_button, next_question). This project runs well on AVD. Later I added a prev_button and its listener for linking to the previous question. I also added a listener for the textview question_text_view. The Eclipse Indigo reported no error, but when running on an AVD, this program stops immediately after it is launched. Where is the problem? Or, how can I find the problems in programs when using such an IDE? Thank you.
Below are some of the programs for this project. (MainActivity.java, activity_main.xml, TrueFalse.java, strings.xml)
MainActivity.java

package com.example1.geoquiz;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

    private Button mTrueButton;
    private Button mFalseButton;
    private Button mNextButton;
    private TextView mQuestionTextView;
    private Button mNextButton2;
    private Button mPrevButton;

    private TrueFalse[] mQuestionBank = new TrueFalse[] {
            new TrueFalse(R.string.question2, true),
            new TrueFalse(R.string.question3, false),
            new TrueFalse(R.string.question4, false),
            new TrueFalse(R.string.question5, true),
            new TrueFalse(R.string.question6, true),
    };

    private int mCurrentIndex = 0;

    private void updateQuestion() {
        int question = mQuestionBank[mCurrentIndex].getQuestion();
        mQuestionTextView.setText(question);
    }
    private void checkAnswer(boolean userPressedTrue) {
        boolean answerIsTrue = mQuestionBank[mCurrentIndex].isTrueQuestion();
        int messageResId = 0;
        if(userPressedTrue == answerIsTrue) {
            messageResId = R.string.correct_toast;
        } else {
            messageResId = R.string.incorrect_toast;
        }
        Toast.makeText(this, messageResId, Toast.LENGTH_SHORT).show();
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mQuestionTextView = (TextView)findViewById(R.id.question_text_view);

        mTrueButton = (Button)findViewById(R.id.true_button);
        mTrueButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                checkAnswer(true);

            }
        });

        mFalseButton = (Button)findViewById(R.id.false_button);
        mFalseButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                checkAnswer(false);
            }
        });

        mNextButton = (Button)findViewById(R.id.next_button);
        mNextButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length;
                updateQuestion();
            }
        });

        /*Click the textview to get to next question.*/
        mNextButton2 = (Button)findViewById(R.id.question_text_view);
        mNextButton2.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length;
                updateQuestion();
            }
        });

        mPrevButton = (Button)findViewById(R.id.prev_button);
        mPrevButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mCurrentIndex = (mCurrentIndex - 1) % mQuestionBank.length;
                updateQuestion();

            }
        });
        updateQuestion();
    }

}

TrueFalse.java

package com.example1.geoquiz;
public class TrueFalse {

    private int mQuestion;
    private boolean mTrueQuestion;
    public TrueFalse(int question, boolean trueQuestion) {
        mQuestion = question;
        mTrueQuestion = trueQuestion;
    }

    public int getQuestion() {
        return mQuestion;
    }
    public void setQuestion(int question) {
        mQuestion = question;
    }
    public boolean isTrueQuestion() {
        return mTrueQuestion;
    }
    public void setTrueQuestion(boolean trueQuestion) {
        mTrueQuestion = trueQuestion;
    }
}

MainActivity.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="${relativePackage}.${activityClass}" >

    <TextView
        android:id="@+id/question_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/true_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="180dp"
            android:text="@string/true_button" />

        <Button
            android:id="@+id/false_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/true_button"
            android:layout_alignLeft="@+id/true_button"
            android:layout_marginLeft="130dp"
            android:text="@string/false_button" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        <Button
            android:id="@+id/next_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/prev_button"
            android:layout_alignBottom="@+id/prev_button"
            android:layout_alignParentRight="true"
            android:layout_marginRight="45dp"
            android:text="@string/next_button" />

        <Button
            android:id="@+id/prev_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="44dp"
            android:text="@string/prev_button" />

    </RelativeLayout>

</RelativeLayout>

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">GeoQuiz</string>
    <string name="question1">Shenzhen is near Hong Kong.</string>
    <string name="question2">The Pacific Ocean is larger than the Atlantic Ocean.</string>
    <string name="question3">The Suez Canal connects the Red Sea and the Indian Ocean.</string>
    <string name="question4">The source of the Nile River is in Egypt.</string>
    <string name="question5">The Amazon River is the longest river in the Americas.</string>
    <string name="question6">Lake Bakal is the world\'s oldest and deepest freshwater lake.</string>

    <string name="true_button">true</string>
    <string name="false_button">false</string>
    <string name="next_button">Next</string>
    <string name="prev_button">Prev</string>

    <string name="correct_toast">correct</string>
    <string name="incorrect_toast">incorrect</string>
</resources>

A:

/*Click the textview to get to next question.*/
mNextButton2 = (Button)findViewById(R.id.question_text_view);
What did I just see?
TextView is not a button. If you're using TextView, you should cast to TextView in your code, not to Button; and set android:clickable="true" in your layout xml resource file

