Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public TextView txtTimer;
- public int count = 5;
- Timer t = new Timer();
- protected override void OnCreate(Bundle savedInstanceState)
- {
- base.OnCreate(savedInstanceState);
- SetContentView(Resource.Layout.Test);
- txtTimer = FindViewById<TextView>(Resource.Id.textTimer);
- Timer t = new Timer();
- t.Interval = 1000;
- t.Elapsed +=T_Elapsed ;
- t.Start();
- }
- private void T_Elapsed(object sender, ElapsedEventArgs e)
- {
- if (count < 0)
- {
- t.Stop();
- //after the 5 seconds ends..i want to stop the timer and start a new activity which is called 'Result' to do another process
- Intent n = new Intent(this, typeof(Result));
- StartActivity(n);
- }
- else
- {
- RunOnUiThread(delegate {
- //display the count down on screen
- txtTimer.Text = count.ToString();
- count--;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement