Use postDelayed() to create a periodic loop that runs on the main
application thread. This will allow you to dump the Timer and the
Handler (BTW, post() and postDelayed() are available on View, such as
your Button).

On Sun, Sep 18, 2011 at 6:54 AM, Subin Sebastian
<[email protected]> wrote:
> (Button)findViewById(R.id.start).setOnClickListener(new
> View.OnClickListener() {
>             public void onClick(View arg0) {
>                 new Timer().schedule(new TimerTask()    {
>                     @Override
>                     public void run() {
>                         new Handler().post(new Runnable()    {
>                             @Override
>                             public void run() {
>                                 new myAsyncTask().execute();
>                             }
>                         });
>                     }
>                 }, 0, 10000);
>             }
>         });
>
> I get exception : java.lang.RuntimeException: Can't create handler inside
> thread that has not called Looper.prepare()
>
>
> Thnaks in advance
> --
> Subin Sebastian
> http://in.linkedin.com/in/subinsebastien
> https://plus.google.com/subin
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> 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



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.6 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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