0
我的任務是有5個問題,每個問題包含5個選項按鈕(Answers)。當我按下一個選項(按鈕)時,該值應該存儲在一個數組中問題option.when我按下一個按鈕相同的過程正在發生,直到5個question.i要存儲的問題和相應的答案每個陣列如何存儲每個按鈕點擊一個數組-Android
公共無效的onClick(視圖v){
case R.id.btnForword:
登入]。我(「計數值」,「」+計數);
if (count < str_Q_QuestionArray.length - 1) {
count = count + 1;
tvQuestion.setText("" + (count + 1) + ". "
+ str_Q_QuestionArray[count]);
btnOpt_1.setText(str_Opt1[count]);
btnOpt_2.setText(str_Opt2[count]);
btnOpt_3.setText(str_Opt3[count]);
btnOpt_4.setText(str_Opt4[count]);
btnOpt_5.setText(str_Opt5[count]);
Log.i("Count Value", "" + count);
} else {
Intent intFeedEmail = new Intent(Feedback.this,
FeedBack_Email.class);
startActivity(intFeedEmail);
}
break;
case R.id.btnPrevious:
Log.i(「Count Value」,「」+ count);
String countTxt = "" + count;
if (count == 0) {
Log.i("Nothing to do ", "" + count);
} else {
count = count - 1;
tvQuestion.setText(countTxt + ". " + str_Q_QuestionArray[count]);
btnOpt_1.setText(str_Opt1[count]);
btnOpt_2.setText(str_Opt2[count]);
btnOpt_3.setText(str_Opt3[count]);
btnOpt_4.setText(str_Opt4[count]);
btnOpt_5.setText(str_Opt5[count]);
Log.i("Count Value ::::", "" + count);
}
break;
情況下R.id.opn1:
btnOpt_1.setBackgroundResource(R.drawable.btn_toggle_blue);
btnOpt_1.setEnabled(false);
String excellent=btnOpt_1.getText().toString();
break;
。 。 。 情況下R.id.opn5:
btnOpt_5.setBackgroundResource(R.drawable.btn_toggle_blue);
btnOpt_5.setEnabled(false);
String bad=btnOpt_2.getText().toString();
break;