I'm creating a boolean array pre-populated with false values. I understand that I don't have to declare false values as they are automatically assigned however I've been trying different methods to try and solve the problem.
package com.bignerdranch.android.geoquiz;
import android.app.ActionBar;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class QuizActivity extends ActionBarActivity {
private static final String TAG = "QuizActivity";
private static final String KEY_INDEX = "index";
private Button mTrueButton;
private Button mFalseButton;
private Button mNextButton;
private Button mCheatButton;
private TextView mQuestionTextView;
private TrueFalse[] mQuestionBank = new TrueFalse[] {
new TrueFalse(R.string.question_oceans, true),
new TrueFalse(R.string.question_mideast, false),
new TrueFalse(R.string.question_africa, false),
new TrueFalse(R.string.question_americas, true),
new TrueFalse(R.string.question_asia, true),
};
private int mCurrentIndex = 0;
private boolean mIsCheater;
private boolean[] mCheatedAnswers = new boolean[] {false, false, false, false, false};
I have a breakpoint on the last line, and when the program breaks here the mCheatedAnswers is instantiated as null. I don't understand why as I have given it a boolean array - does anyone know why this could be?
The previous variables all have the correct values assigned to them when I check them in the debug mode.