请教我如何停止跑步。”handler.removecallback(ss)“不起作用。还是我的程序错了?
int life = 100, damage = 5;
public void gameOver()
{
((TextView)findViewById(R.id.textView6)).setVisibility(View.VISIBLE);
}
final Runnable sS = new Runnable()
{
@Override
public void run()
{
life = life - damage;
String lifeHP = String.valueOf(life);
((TextView)findViewById(R.id.textView)).setText(lifeHP);
handler.postDelayed(this, 300);
if (life < 0 )
{
gameOver();
//handler.removeCallback(ss)--does not work.
}
}
};
handler.post(sS);
暂无答案!
目前还没有任何答案,快来回答吧!