[android-developers] Re: Database shared by Activity and Service. What's the best approach?

2011-04-17 Thread bogde
Thanks for your suggestion Dianne. In addition to storing the values, I need to show the evolution on a chart and possibly to export the data in some format (like CSV) at a later time. With this in mind, I guess the CP + sqlite back end approach is the easiest for me at this time. Let's say I need

[android-developers] Re: Database shared by Activity and Service. What's the best approach?

2011-04-17 Thread Sahil Verma
Instead of repeatedly hitting the database to see if something is available, you could find some way for the service to send the new datum to the application when it is received from the external device. I think this could be achieved with an explicit intent. This allows the application to

[android-developers] Re: Database shared by Activity and Service. What's the best approach?

2011-04-16 Thread bogde
Thanks for the suggestion. I wasn't clear enough, I'm reading two analog values and store them over time; I store two values every ten seconds, so I need a database. I implemented a content provider and everything seems to work great so far. Actually, it worked pretty well before, except I used

Re: [android-developers] Re: Database shared by Activity and Service. What's the best approach?

2011-04-16 Thread Dianne Hackborn
If you really care about performance, and all you are doing is reading two values and writing them over time, just appending this as binary data to a file would be far, far more efficient than using a SQLite database. On Sat, Apr 16, 2011 at 1:10 PM, bogde bogde...@gmail.com wrote: Thanks for

[android-developers] Re: Database shared by Activity and Service. What's the best approach?

2011-04-15 Thread bogde
Thank you both for taking the time to reply. I read about ContentProvider and also read the thread you gave me. It definitely looks like CP is the best approach for me. So I will have the service write data to the database via CP, and the Activity will use CP to display data. I wonder if this

Re: [android-developers] Re: Database shared by Activity and Service. What's the best approach?

2011-04-15 Thread Kostya Vasilyev
Two values? Service running all the time? Just put them into static variables accessible from both your Service and Activity classes. Back up into shared preferences or a file, so you can reload the latest values if/when the service/process is killed. -- Kostya 14.04.2011 11:17, bogde

[android-developers] Re: Database shared by Activity and Service. What's the best approach?

2011-04-14 Thread lbendlin
Another option is to open the database in the launch activity, and then keep a reference to it in the application object so that it can be used from anywhere. Close the database in the onDestroy of the launcher activity. -- You received this message because you are subscribed to the Google

[android-developers] Re: Database shared by Activity and Service. What's the best approach?

2011-04-13 Thread gjs
Hi, +1 contentprovider. This thread is possibly worth reading - http://groups.google.com/group/android-developers/browse_thread/thread/20d8cbf7bf88f6d9 Regards On Apr 14, 2:22 pm, Nikolay Elenkov nikolay.elen...@gmail.com wrote: On Tue, Apr 12, 2011 at 5:32 PM, bogde bogde...@gmail.com