How to make data independent of activity

by rajaramyadhav » Sat, 17 Jul 2010 02:25:35 GMT

Sponsored Links
 Hi All,

I am new to  Android development. My requirement is something like
this. I have two list activities and a service. I also have to
maintain some data in an two different arraylist which are used by the
activity to display. The data will be populated by the service. Since
adding the new elements to arraylist has to be done by the service,
the data has to be independent of the activity. So I had to put it in
an external class. Now whenever an element is added the activity
should be notified. How can I do this in a clean way? I somehow made
it to work using a static handler for activity and a static adapter .
But I dont think this is a good way to do this.  Can someone suggest
me a better way?

Any sample code snippets would help too..

Thanks in advance for your help.
Raja Ram