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;
}
왜 아래로 투표를? 이것은 금지를 원치 않는 제 3 번째 계정입니다! – user2558256
http://stackoverflow.com/questions/4768969/how-do-i-change-textview-value-inside-java-code & http://stackoverflow.com/questions/12613898/android-textview-value –
너 downvotes 금지하지 마십시오. – Simon