July 2015
Beginner to intermediate
600 pages
18h 59m
English
In this chapter, you will find out what to do when apps get buggy. You will learn how to use LogCat, Android Lint, and the debugger that comes with Android Studio.
To practice debugging, the first step is to break something. In QuizActivity.java, comment out the code in onCreate(Bundle) where you pull out mQuestionTextView.
Listing 4.1 Comment out a crucial line (QuizActivity.java)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate() called");
setContentView(R.layout.activity_quiz);
mQuestionTextView = (TextView)findViewById(R.id.question_text_view);
// mQuestionTextView = (TextView)findViewById(R.id.question_text_view); mTrueButton ...Read now
Unlock full access