我制作专家系统应用程序,我有两个按钮(上一个和下一个)。下一步按钮是工作,但当我点击上一个按钮它不起作用。它不会返回上一页,而是直接返回主活动。这是我的整个活动:
这是上一个按钮:
butBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
finish();
}
});
这是下一个按钮:
butNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RadioGroup grp=(RadioGroup)findViewById(R.id.radioGroup1);
RadioButton answer=(RadioButton)findViewById(grp.getCheckedRadioButtonId());
Log.d("yourans", currentQ.getANSWER()+" "+answer.getText());
cfpakar = currentQ.getANSWER();
if(qid<=4){
if(answer == rda){
cfuser = 0;
} else {
cfuser = 1;
tahap1++;
}
if(qid < QuestList.size()){
cf = cfpakar * cfuser;
currentQ=QuestList.get(qid);
setQuestionView();
}else{
Intent intent = new Intent(QuestActivity.this, Result.class);
Bundle b = new Bundle();
//Bundle c = new Bundle();
b.putDouble("score", score); //Your score
b.putInt("tahap1", tahap1);
b.putInt("tahap2", tahap2);
b.putInt("tahap3", tahap3);
//b.putInt("hasil", hasil);
intent.putExtras(b); //Put your score to your next Intent
startActivity(intent);
finish();
}
}
});
}
请帮助我,我应该添加到上一个按钮?谢谢你......