Wednesday, August 3, 2011

Re: [android-developers] Re: Refreshing ListView After Home Key is Pressed and Returning to App

If you're closing the SQLiteOpenHelper, it means you're closing the
database.

A closed database is just that, closed, and will need to be reopened -
e.g. in onRestart. You will also need to run a new query, to get a fresh
-- open -- cursor that you can work with.

A better way is to keep the database open at all times, and use a Java
singleton so that there is only one database object instance in the
entire application. This has been extensively discussed, search the list
archives.

-- Kostya

04.08.2011 0:27, usafrmajor пишет:
> It is the class that I created that interacts with a database table.
> It does the inserts, updates, deleted and selects from the db table.
>
> It uses these classes
>
> import android.content.ContentValues;
> import android.content.Context;
> import android.database.Cursor;
> import android.database.SQLException;
> import android.database.sqlite.SQLiteDatabase;
> import android.database.sqlite.SQLiteOpenHelper;
> import android.util.Log;
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

--
Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment