在这里我的问题是如何显示按钮,一个新的形象被点击,但条件是从其他下课。 在这里我是一个新手,我想知道如何在类与其他类连接。 我试过的意图......
这里是我的代码
这是类我们的问题的?
@Override
// TODO Auto-generated method stub
public void onClick(View v) {
String answer = "Marianas Trench";
String answer2 = "marianas trench";
String answer3 = "MARIANAS TRENCH";
String check = input.getText().toString();
if (check.contentEquals(answer)){
tvresult.setText("Correct");
Intent myIntent= new Intent("com.turtleexploration.LEVEL1");
startActivity(myIntent);
}else if (check.contentEquals(answer2)){
tvresult.setText("Correct");
Intent myIntent= new Intent("com.turtleexploration.LEVEL1");
startActivity(myIntent);
}else if (check.contentEquals(answer3)){
tvresult.setText("Correct");
Intent myIntent = new Intent("com.turtleexploration.LEVEL1");
startActivity(myIntent);
}else{
tvresult.setText("Wrong");
}
Intent intObj = new Intent(Question.this, Level1.class);
intObj.putExtra("ANSWER", answer);
startActivity(intObj);
}
这是问题选择类..
ImageButton l1 = (ImageButton) findViewById(R.id.l1);
TextView t1 = (TextView) findViewById(R.id.t1);
Intent intename = getIntent();
String mainans = "Marianas Trench";
String ans = (String) intename.getSerializableExtra("ANSWER");
if (ans == mainans){
l1.getBackground().equals(getResources().getDrawable(R.drawable.m1));
t1.setText("Correct");
}else{
}
按钮是问题选择菜单...