Errors with displaying TextView and having usable code

#1

For chapter 2 when we add the next button we are adding the next button if I were to enter the code exactly into android studio as it is in my book I would get a big error in the logcat followed by the app crashing:

04-06 01:10:34.526 21232-21232/com.example.hodorviii.geoquiz E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.hodorviii.geoquiz, PID: 21232
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hodorviii.geoquiz/com.example.hodorviii.geoquiz.QuizActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0
com.example.hodorviii.geoquiz.QuizActivity.updateQuestion(QuizActivity.java:70)
at com.example.hodorviii.geoquiz.QuizActivity.onCreate(QuizActivity.java:64)

                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:158) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:7237) 
                                                                               at java.lang.reflect.Method.invoke(Native Method) 

Well I go and see what is wrong with QuizActivity at lines 70 and 64 which gives us

64 updateQuestion();
}

private void updateQuestion() {

    int question = mQuestionBank[mCurrentIndex].getTextResId();

70 mQuestionTextView.setText(question);

once again these are exactly how the book tells us to enter in this part of the program, so after looking around at what others think the solution is i end up with

64 updateQuestion();
}

private void updateQuestion() {

    int question = mQuestionBank[mCurrentIndex].getTextResId();

70 mQuestionTextView.setText(question+"");
}

and now my program works, but now my TextView is only displaying 0 regardless of what values I try and assign or if I try and use the next button.

and here is my QuizActivity from top to bottom:

package com.example.hodorviii.geoquiz;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class QuizActivity extends AppCompatActivity {

private Button mTrueButton;
private Button mFalseButton;
private Button mNextButton;
private TextView mQuestionTextView;
private Question[] mQuestionBank = new Question[]{
        new Question(R.string.question_australia, true),
        new Question(R.string.questions_oceans, true),
        new Question(R.string.question_mideast, false),
        new Question(R.string.question_africa, false),
        new Question(R.string.question_americas, true),
        new Question(R.string.question_asia, true),
};

private int mCurrentIndex = 0;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quiz);

    mQuestionTextView = (TextView) findViewById(R.id.question_text_view);
    int question = mQuestionBank[mCurrentIndex].getTextResId();
    mQuestionTextView.setText(question+"");


    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();
        }

    });

    updateQuestion();
}

private void updateQuestion() {

    int question = mQuestionBank[mCurrentIndex].getTextResId();
    mQuestionTextView.setText(question+"");
}


private void checkAnswer(boolean userPressedTrue) {
    boolean answerIsTrue = mQuestionBank[mCurrentIndex].isAnswerTrue();

    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();

}

}

#2

Can you post your Question class?

#3

Thank you so much!!! I reviewed my Question class and that is where I found my error!