You need to create the AsyncTask instance on the UI thread, but the
doInBackground() method runs in a separate thread.

The reason for creating the AsyncTask instance on the UI thread is so
that it can connect to the proper Looper and MessageQueue for that
thread. (It does this through a single static Handler, so it will not
work correctly if you first load the class in a different thread.
That's unnecessarily fragile, in my opinion, but not a problem if you
are using it as intended, as an easy way to move code off the main
thread.)

On Dec 30, 9:39 pm, water boiled <[email protected]> wrote:
> I mean that can i create AsycnTask instance not in UI thread?
>
> On 12月31日, 下午1时30分, water boiled <[email protected]> wrote:
>
>
> > I mean that can i AsycnTask instance not in UI thread?
>
> > On 12月31日, 下午1时24分, water boiled <[email protected]> wrote:
>
> > > the AsycnTask document says that:The task instance must be created on
> > > the UI thread.
>
> > > why create task instance must be created in UI thread?
>
> > > On 12月29日, 上午10时26分, Frank Weiss <[email protected]> wrote:
>
> > > > It's difficult to understand what you are asking. What problem are you
> > > > having with AsyncTask.

-- 
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