Hi, 1.) Yes, I meant "long running thread".
2.) The bus framework looks really appealing, and design-wise it actually decouples activity and background tasks and still gives a callback functionality on to activity in a cleaner way. But as you said, it is still going a major revamp so does not look completely ready yet? I just found a really interesting article for doing something like that. Here's the link for that http://jnb.ociweb.com/jnb/jnbJan2009.html. Could you guys shed your opinion on this if the approach taken in the above article makes sense or does it also suffer from any major drawbacks.(I was thinking of just replacing their "DataFetcherThread" class with Async Task). "Phew!!!! only if google had taken some other approach instead of automatically destroying activities. We just finished a succesful huge project using blackberry apis and never had to worry on this type of issue about orientation effects or phone call receive[Again I am trying my level best to be positive with android framework here, because I really want to like it.)].. On Aug 5, 3:09 pm, Mark Murphy <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---

