내 질문에 작은 게임에 대한 답변을 데이터베이스 파일에서 표시하고 있습니다. 질문은 텍스트보기에 있으며 답변은 radiobuttons.no에 있습니다. 데이터는 정확하게 내가 원하는 방식으로 표시되지만 데이터를 선택할 때 라디오 버튼의 첫 번째 옵션 만 올바른 대답 일 경우에만 올바른 ansnwer로 선택됩니다. mainactivity 내 코드는 다음과 같습니다`showQuestion = (TextView) findViewById (R.id.tvQuestions); showAnswer = (TextView) findViewById (R.id.tvShowAnswer);첫 번째 옵션 만 표시하는 라디오 버튼과 안드로이드의 모든 잘못된 데이터를 보여주는 다른 버튼
radioGroup = (RadioGroup) findViewById(R.id.radioGroup1);
r0 = (RadioButton) findViewById(R.id.radio0);
r1 = (RadioButton) findViewById(R.id.radio1);
r2 = (RadioButton) findViewById(R.id.radio2);
r3 = (RadioButton) findViewById(R.id.radio3);
bsubmit = (Button) findViewById(R.id.bsubmit);
bsubmit.setOnClickListener(this);
String shoow = myDb.makeatext(levels, Qno);
String showextra1 = myDb.makeExtra1(levels, Qno);
String showextra2 = myDb.makeExtra2(levels, Qno);
String showextra3 = myDb.makeExtra3(levels, Qno);
String showextra4 = myDb.makeExtra4(levels, Qno);
// String showextra4 =myDb.makeanswers(levels, Qno);
showQuestion.setText(shoow);
r0.setText(showextra1);
r1.setText(showextra2);
r2.setText(showextra3);
r3.setText(showextra4);
및 데이터 검사를 시도하는 onclick() 메소드에서 데이터가 올바른 경우에만 첫 번째 라디오 버튼 응답 만 올바른 것으로 표시됩니다. 내가 큰 도움을
감사 매디 될 것입니다 안드로이드 .IT에 새로운 오전 그것의
public void onClick(View v) {
strat = System.currentTimeMillis();
data = myDb.makeanswers(levels, Qno);
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.bsubmit:
if (r0.isChecked() == true)
{
if (r0.getText().toString().equalsIgnoreCase(data)) {
showAnswer.setText("your answer is correct:" +r0.getText());
} else {
showAnswer.setText("your answer is wrong.the answer is:"
+ data);
}
}
if (r1.isChecked() == true)
{
if (r1.getText().toString().equalsIgnoreCase(data)) {
showAnswer.setText("your answer is correct:" + r1.getText());
} else {
showAnswer.setText("your answer is wrong.the answer is:"
+ data);
}
}
if (r2.isChecked() == true)
{
if (r2.getText().toString().equalsIgnoreCase(data)) {
showAnswer.setText("your answer is correct:" + r2.getText());
} else {
showAnswer.setText("your answer is wrong.the answer is:"
+ data);
}
}
if (r3.isChecked() == true)
{
if (r3.getText().toString().equalsIgnoreCase(data)) {
showAnswer.setText("your answer is correct:" + r3.getText());
} else {
showAnswer.setText("your answer is wrong.the answer is:"
+ data);
}
}}}
PLZ 도와주세요.
완벽한 작동 코드 내 조각이다. – MADDY
당신은 문자열 형식으로 받아 들일 수 있습니다 –
잘 내가 문자열 형식을 시도했지만 라디오 버튼에서 문자열로 – MADDY