Yes, I am familiar with that mechanism. However, that is not like the
event/eventhandler mechanism that is available in javascript/gwt. In the
asynctask mechanism, the asynctask#postExecute runs on the UI thread and the
asynctask needs to passed in a view if a specific view needs to be updated.
however, in the javascript mechanism of event/eventhandler, the component
that fires the event does not need to know anything about who is going to
receive that event. So, it allows for a bit of modular design (clean
separation of functionality/view logic/data model). The async task mechanism
is, like you said, a multi-threading mechanism in android, however, the
event/eventhandler model is more akin to javascript's event model or akin to
the JMS publish/subscribe model in JEE. I can see how the async task
mechanism can be used in lieu of the event/eventhandler mechanism, but thats
not apples to apples. make sense?

Thanks for your response!

On Tue, Jul 5, 2011 at 12:43 AM, Jastp <jaswant1...@gmail.com> wrote:

> It's so simple:
> There r two best ways:
> 1. Create a class extending AsyncTask and overrides it's doBackgroud() and
> and on postExecute() methods
>     and write your code of fetching data from server in doBackground() mtd
> and onPostExecute() write ur code of db updation and start a new activity;
>
> 2.Another ways is the use of traditional java threading;
> just start a new thread and write your code of fetching data from server
> and code of db updation
> in run() mtd and after that code use Activity's
> runOnUiThread() mtd to start new activirty
>
>  --
> 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
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to