Wednesday 15 January 2014

android - how to repeat code for certain counts? -


I would like to reiterate a certain amount of toast and not only does it still look like it does it loop timer Delay?

  public class extends the main activity (button Bitian; editing text editing; Tekstdrishy scene; timer Maytimr = new Timer (); MyTimerTask myTimerTask = new MyTimerTask (); void protected override @ Create (bundle saved Instansstet) {Suprknkret (saved Instensstet); setContentView (R.layout.activity_main); Bitian = (button) searching for Vivibiaiaidi (Araidkbu); Btn.setOnClickListener (see new. OnClickListener) {@ Override clear on public zeros (See V) {Edit = (editable text) findViewById (R.id.ed1); view = (TextView) findViewById (R.id.te); int Aa = Integer.valueOf (edit.getText (). ToString ()); view.setText (edit.getText (). ToString ()); myTimer.scheduleAtFixedRate (myTimerTask, aa, aa);}}); } Private class MyTimerTask TimerTask {@ Override Public Wide Run () (runonUITread (new Runnabel) {@ Override Public Wide Run) // Code Toast. GetBaseContext, "Toast Test", Toast.). Show (); // How to replicate this toast for a few caps just now not just looping}}); }}    

You can raise a counter in each execution of MyTimerTask.run Are () . Then when you want to show the toaster notification several times over this counter, you can see the timer cookies to myTimer.cancel (); . Can Cancel

No comments:

Post a Comment