Android Force quit CountDownTimer/Toast -
Then I have "hack" to keep the toast period for a while:
// toast ... zanimivosti = new toast (getApplicationContext ()); Zanimivosti.setGravity (Gravity. Cntte ARTO, 0, 0); Zanimivosti.setView (layout); New Countdown Timer (4000, 1000) {Tick on Public Zero (Long Mills Unselected) {zanimivosti.show (); } Public void onFinish () {zanimivosti.show (); } }.Start();
Issue: When a user goes to another intention, it may be that the toaster of the toaster is again in new intentions. CountDownTimer.cancel () in my case; Will not work
Optional: Every time I show a news to the app to lunch to the user in my toast. I will also consider that a better solution is the command of a toast that a user disappears when they click on it or when a new intention is also called, it disappears. Should I Use the Popup Dialog? Can I disappear when the user clicks on it?
Finally I did this:
toast zanimovosti; Int Cas = 4000; Int Peridro = 1000; Boolean boolean_toast = true; Count timer timer; Timer = new countdown timer (time, perioda) {tick on public zero (long unilified) {zanimivosti.show (); } Public void onFinish () {if (boolean_toast == true) {zanimivosti.show (); } Else {}}} Start ();
And withhold / cancel the timer with all possible things:
boolean_toast = false; Time = 0; Perioda = 0; Timer.cancel (); Zanimivosti.cancel ();
Comments
Post a Comment