But this implementation doesn't have same functionality as Timer, you
can't update the screen at predefined interval.

On Dec 9, 10:33 pm, Xiongzh <[EMAIL PROTECTED]> wrote:
> My reimplementation using view.postDelay(Runnable action, long
> milliseconds);
>
> package com.example.android.helloactivity;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.widget.EditText;
>
> /**
>  * A minimal "Hello, World!" application.
>  */
> public class HelloActivity extends Activity {
>
>         static int seq = 0;
>         private Runnable mSpeaker = new Runnable() {
>                 public void run() {
>                         sayHelloWorld();
>                 }
>         };
>
>         public HelloActivity() {
>     }
>
>         @Override
>         protected void onResume() {
>                 sayHelloWorld();
>                 super.onResume();
>         }
>
>         @Override
>         protected void onPause() {
>                 super.onPause();
>         }
>
>         private void sayHelloWorld() {
>                 EditText helloEditText = (EditText)findViewById(R.id.text);
>                 helloEditText.setText("Hello world " + (++seq));
>                 helloEditText.postDelayed(mSpeaker, 3000);
>         }
>
>     /**
>      * Called with the activity is first created.
>      */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.hello_activity);
>     }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to