On Nov 16, 12:49 pm, bharath <[email protected]> wrote:
> can any one tell me how to store and retrieve  arraylist in/from
> sqlite
>
> ArrayList<Double> results = new ArrayList<Double>();

Hmm, it's not an easy question to answer as it depends really on how
it's used. Best practise is probably to create a dedicated table for
array-list entries, this would contain their place in the list, the
value (or a reference to the value), and some kind of array-list ID
that can be referenced.

So for example, you have an entry for a location, which will store an
ID of "4", this points to an "array-list" of events at that location.
With that ID you'd perform a SELECT on the array-list table, looking
for all entries with ID 4, and sorting by their index field, this will
get you all the entries you need to rebuild the array-list.

Hope that makes some sense? If you can give more of an idea of how
exactly you'll be using this, there may be better ways. For example,
if the array-list has a restricted size, then there are less "correct"
but potentially better performing solutions you could use.

The overkill way is to just serialise the list and store it in a
field, but that restricts your options for searching, sorting, and
performing smaller updates.

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