Android Programming The Big Nerd Ranch Guide, 3rd Edition

(Brent) #1

Chapter 4  Debugging Android Apps


86

Figure 4.8  Lint warnings


You can select an issue in this list to see more detailed information and its location in your project.


The Mismatched view type warning in the Android > Lint > Correctness category is the one that you
created above. Go ahead and correct the cast in onCreate(Bundle).


Listing 4.8  Fixing that simple mix-up (QuizActivity.java)


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate(Bundle) called");
setContentView(R.layout.activity_quiz);


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


mTrueButton = (Button)findViewById(R.id.question_text_view);
mTrueButton = (Button)findViewById(R.id.true_button);
...
}


Run GeoQuiz once more and confirm that the app is back to normal.

Free download pdf