IM開發一個簡單的測驗統計用戶回答測驗項目的數量已經存儲了50個問題在那裏,它是隨機displayed..my問題is..how我可以指望的項目數用戶回答測驗..例如,我有50個問題,如果用戶只回答10,該怎麼辦?所以我希望它顯示在我的分數(對話框)中的玩家的分數和用戶回答的項目數。請幫助我..請問我能做到這一點???幫助真的很感激!如何使用JSON陣列
private OnClickListener finishListener = new OnClickListener() {
public void onClick(View v) {
setAnswer();
//Calculate Score
int score = 0;
int count = 0;
for(int i=0; i<correctAns.length; i++)
{
if ((correctAns[i] != -1) && (correctAns[i] == selected[i]))
score++;
}
count++;
AlertDialog alertDialog;
alertDialog = new AlertDialog.Builder(Question2.this).create();
alertDialog.setTitle("Your Score");
alertDialog.setMessage("You've got "+(score)+" out of " + (count) + " items");
alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE,"Okay", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Question2.this,
MainMenu.class);
startActivity(intent);
}
});
alertDialog.show();
}
};
,我該怎麼做?請告訴我品嚐code..thanks – user2079544 2013-02-27 17:31:11
@ user2079544 - 對於前 - 說出隱藏的變量稱爲arrayCounter每一次的用戶選擇從我們調用javascript函數userSelectedfromList列表中任何東西()。 。
..... – 2013-02-28 18:09:12