[SOLVED] Listing 2.7 - Cannot convert TextView to Button


#1

Man I am really loving this book!

However, I am getting a compiler error in listing 2.7:

Code:

[code] protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quiz);

    mQuestionTextView = (TextView)findViewById(R.id.question_text_view); // typecasted mQTV to a version of Textview
    int question = mQuestionBank[mCurrentIndex].getQuestion();
    mQuestionTextView.setText(question);[/code]

Error:

Multiple markers at this line - Type mismatch: cannot convert from TextView to Button - Line breakpoint:QuizActivity [line: 35] - onCreate(Bundle)

Does anybody know how to fix the errors?

[size=150]Edit: Fixed it!
I had: private Button mQuestionTextView; instead of: private TextView mQuestionTextView;[/size]