0
我正在尝试设置一个测验,其中每个答案都会为总分添加一定数量的分数。目前,我关心单选按钮。我已经建立了一个radiogroup,我希望选择添加到总分中的任何单选按钮。这只是我的程序的一部分而已。如何在测验应用程序中设置评分系统?
当我按下xml布局文件底部的按钮时,我希望将与单选按钮相关的分数添加到总分中。你明白吗?
下面是实际的XML布局文件中的类文件:
Public class QuestionOne extends Results {
RadioButton answer1, answer2, answer3;
Button oneNext;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.one);
RadioButton answer1 = (RadioButton) findViewById(R.id.oneradio1);
RadioButton answer2 = (RadioButton) findViewById(R.id.oneradio2);
RadioButton answer3 = (RadioButton) findViewById(R.id.oneradio3);
Button oneNext = (Button) findViewById(R.id.onenext);
}
}
它扩展了结果类,我这样做所以它继承了比分整数。以下是评分等级:
public class Results extends Activity {
private int score;
public int getScore() {
return score;
}
public Results(int score) {
this.score = score;
}
}
我得到的结构从谷歌上搜索和它的有效性是值得怀疑的,我知道,但我觉得我有基本的了解。谁能帮我吗?
怎么样一个新的意图?我可以把它放在案例和断线之间吗? – MiKenning
另外,谢谢!这个效果很好,我认为! – MiKenning
是的,当然可以!添加到总分中,然后调用一个新的Intent。而且,你非常欢迎! :) – Swayam