First Challenge in Chapter 2 of Android Programming book


#1

Hi,

I’m having trouble with the first Challenge in Chapter 2. My code is as follows:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    mQuestionTextView = (TextView)findViewById(R.id.question_text_view);
 //   int question = mQuestionBank[mCurrentIndex].getQuestion();
 //   mQuestionTextView.setText(question);
    
     mQuestionTextView.setOnClickListener(new View.OnClickListener() {

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

Are there other changes I need to make to make this work? I’m new to Android programming. I’ve been a COBOL Developer and am very new to this type of programming.

Thanks,

Bob


#2

This code just started to work. I guess I was running a previous version of GeoQuiz:)


#3

Glad to hear you fixed your issue!