Vikas wrote:
> 1.) What is the right place to put this long runing task to

I do not think there is one universal "right place". As the Perl folk
like to say, TMTOWTDI.

http://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it

> Is it Async Task or Local service or any third way?

AsyncTask and a local service are orthogonal. Your choice of *how* you
manage your background thread (AsyncTask, etc.) and your choice of *who*
manages the background thread (Activity, Service, Application) are
largely independent choices.

> (And how will a
> newly created activity attach itself to this old long running process)

You mean "thread". It is an "old long running thread", not a process.

Have the Activity call a method on whoever is managing the background
thread. If it is a local service, have the Activity call a method on the
local service, or on some intermediary that is managing the communications.

For example, for a few projects I am working on, I have set up an event
bus model to handle this scenario:

https://github.com/commonsguy/cwac-bus/tree

(note that the posted code is undergoing heavy revision, your mileage
may vary, etc.)

> I have to create 100 such screens and a solid foundation will go long
> way.

Hopefully, those are spread over 20-30 applications.

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

Android Development Wiki: http://wiki.andmob.org

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