0
私はハンドラと実行可能ファイルを持っていますが、ハンドラには0から5までのループがあります。ハンドラで実行可能ファイルを起動し、値を0から5までインクリメントします。ダブルクリックするか、1回以上クリックしてください。これは、5より大きいtempの値よりも大きくなります。どのようにすれば、ハンドラをクリックするたびにtempの値をリセット(0)できますか?Androidで実行可能変数をリセットする方法
final Handler deneme = new Handler();
final Runnable post_score = new Runnable(){
public void run(){
Log.i("TAG", Integer.toString(temp));
temp++;
}
};
Button tv = (Button)findViewById(R.id.button1);
tv.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
temp = 0;
for(int i=0; i < 5;i++){
deneme.postDelayed(post_score, i *250);
}
}
});
を使用することですか? – silly
実行定義自体のfor()の前にリセットすることができます – Suman