public class game extends Activity{ //<- Change this (game)!
private int shoot=10;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.game); //<- Change this!
}
private void update(Button button){
rounds.setText("Bullets"+ shoot--); //Update the information of the button
}
public void onClick(View button) { //When you click
update((Button) button); //Activates the update
}
或者你也可以使用:
TextView rounds;
public void onClick(View arg0) {
switch(arg0.getId()) {
case R.id.button1:
rounds.setText("Bullets"+ shoot--);
break;
}
爲什麼向下票呢?這是我的第三個帳戶,我不想禁止! – user2558256
http://stackoverflow.com/questions/4768969/how-do-i-change-textview-value-inside-java-code&http://stackoverflow.com/questions/12613898/android-textview-value –
你不要被禁止降薪。 – Simon