My solution to 3rd problem


#1

[code]private static final String KEY_CHEATED_QUESTIONS = “cheated_questions”;
private ArrayList mCheatedQuestions;

if (savedInstanceState != null) {
mCurrentIndex = savedInstanceState.getInt(KEY_INDEX, 0);
mCheatedQuestions = savedInstanceState.getIntegerArrayList(KEY_CHEATED_QUESTIONS);
}
else
mCheatedQuestions = new ArrayList();

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (data == null)
return;

boolean mIsCheater = data.getBooleanExtra(CheatActivity.EXTRA_ANSWER_SHOWN, false);

if (mIsCheater && !mCheatedQuestions.contains(mCurrentIndex))
	mCheatedQuestions.add(mCurrentIndex);

}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(KEY_INDEX, mCurrentIndex);
outState.putIntegerArrayList(KEY_CHEATED_QUESTIONS, mCheatedQuestions);
}

private void checkAnswer (boolean userPressedTrue) {
boolean answerIsTrue = mQuestionBank[mCurrentIndex].isTrueQuestion();
int messageId;

if (mCheatedQuestions.contains(mCurrentIndex))
	messageId = R.string.judgment_toast;


[/code]