对不起,如果我问,如果测验公式的结果是这样的话,谁能帮助我的Android项目……
如果A等于B,C,D,则结果为E
使用图像按钮和6个问题的选择
我在string.xml中键入的结果是什么代码,所以每个结果声明都称为... ??
请帮助我
----在我的代码下,上述公式的语句如何:-----
public class mquiz extends Activity implements View.OnClickListener{
Button btn_next;
ImageButton jawabA, jawabB, jawabC, jawabD;
TextView question;
String [] kuisioner ={"Your hobbies..??","Which object do you like...??"};
//Pilihan Gambar
int [] pilihA ={R.drawable.seeing, R.drawable.picture};
int [] pilihB ={R.drawable.singing, R.drawable.songer};
int [] pilihC ={R.drawable.readwrite, R.drawable.writestory};
int [] pilihD ={R.drawable.activity, R.drawable.football};
private int indeks;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_quiz);
setContentView(R.layout.menu_quiz1);
question=(TextView)findViewById(R.id.question);
question.setText(kuisioner[0]);
jawabA=(ImageButton)findViewById(R.id.pilihanA);
jawabA.setImageResource(pilihA[0]);
jawabA.setOnClickListener(this);
jawabB=(ImageButton)findViewById(R.id.pilihanB);
jawabB.setImageResource(pilihB[0]);
jawabB.setOnClickListener(this);
jawabC=(ImageButton)findViewById(R.id.pilihanC);
jawabC.setImageResource(pilihC[0]);
jawabC.setOnClickListener(this);
jawabD=(ImageButton)findViewById(R.id.pilihanD);
jawabD.setImageResource(pilihD[0]);
jawabD.setOnClickListener(this);
}
@Override
public void onClick(View view){
indeks++;
if (view == jawabA){
jawabA.setImageResource(pilihA[indeks]);
}
if (view == jawabB){
jawabB.setImageResource(pilihB[indeks]);
}
if (view == jawabC){
jawabC.setImageResource(pilihC[indeks]);
}
if (view == jawabD){
jawabD.setImageResource(pilihD[indeks]);
}
if (view == btn_next){
Intent start = new Intent(mquiz.this, samplequiz.class);
startActivity(start);
}
}