Witajcie,
mam błąd Variable 'answer' is assigned but never accessed
. Jak go naprawić? I drugie pytanie - jaki dać parametr w textViewDisplayResult
?
String allChecked = "", answer = "";
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
if (bundle.containsKey("KEY_ALL_CHECKED"))
allChecked = bundle.getString("KEY_ALL_CHECKED");
answer = bundle.getString("KEY_ANSWER");
}
textViewDisplayResult.setText(???????????);
trochę zmieniona metoda buttonCheckAnswer
buttonCheckAnswer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (allAnswersChecked())
{
if (checkAnswers())
intent.putExtra("KEY_ANSWER", R.string.Good_answer);
else
intent.putExtra("KEY_ANSWER", R.string.Wrong_answer);
}
else
intent.putExtra("KEY_ANSWER", R.string.text_not_checked);
startActivity(intent);
}
});