Zrobiłem aplikację w Android i wykorzystywane czasomierz tak ..timerem nie zatrzymuje się w android
try {
CountDownTimer start1 = new CountDownTimer(20000, 1000) {
public void onTick(long millisUntilFinished) {
TextView timeShow = (TextView)findViewById(R.id.showTime);
timeShow.setText(" "+" 00:" +millisUntilFinished/1000);
}
Ale mój problem jest nie wiem jak zatrzymać stoper. Dowolny pomysł?
Próbowałem już:
quitApplication.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
start1.cancel();
Intent i = new Intent(v.getContext(), startGame.class);
startActivity(i);
// TODO Auto-generated method stub
}
});
ja już próbowałem, ale nie obsługuje. – BIBEKRBARAL
Czy możesz nam pokazać, jak to robisz? Być może, problem może leżeć ... – Prashast
użyłem start1.cancel następująco ... quitApplication.setOnClickListener (nowa OnClickListener() \t \t { \t \t \t public void onClick (View v) \t \t \t { \t \t \t \t \t \t \t start1.cancel(); \t \t \t \t inten t i = new Intent (v.getContext(), startGame.klasa); \t \t \t startActivity (i); \t \t \t \t \t \t \t // Do zrobienia Automatycznie generowane metodą skrótową \t \t \t \t \t \t \t} \t \t \t \t \t \t \t}); – BIBEKRBARAL