Wondering if you ever solved this? I am getting a similar problem and
I have not found anything that works, or others solutions.


On Nov 26, 10:30 pm, "bharath kumar" <bhrthkum...@gmail.com> wrote:
> Hi AndroidDev,
> 11-24 19:27:38.287: ERROR/Database(5891): Leak found
> 11-24 19:27:38.287: ERROR/Database(5891): java.lang.IllegalStateException:
> /data/data/com.vista.examples.List/databases/ev_data SQLiteDatabase created
> and never closed
>
> i got the above error .how to resolve the problem.?
>
> Also ,please check my code below to create the database and accessign the
> database.
>
> [/code]public void onCreate(Bundle icicle) {
> super.onCreate(icicle);
> initDB(this);
> //mOpenHelper=new DatabaseHelper(this);
> itla = new IconifiedTextListAdapter(this);
> showEventList();}
>
> public void initDB(Context ctx) {
> db = ctx.openOrCreateDatabase(EVENT_DATA,
> Context.MODE_WORLD_WRITEABLE,null);
> db.execSQL("CREATE TABLE IF NOT EXISTS " + EVENT_DATA
> + " (EventType VARCHAR,Description VARCHAR, Image INTEGER,Msg_Template
> TEXT);");
>
> }
>
> public void showEventList() {
> SQLiteDatabase vDB=null;
> try{
> vDB=SQLiteDatabase.openDatabase(getDatabasePath(EVENT_DATA).toString(),
> null,SQLiteDatabase.OPEN_READONLY ); }catch(SQLiteException sqe){
> sqe.printStackTrace();}
>
> Cursor cursor=vDB.query(EVENT_DATA, new
> String[]{"EventType,Image,Description"}, null, null, null, null, null);
> cursor.moveToFirst();
> for(int position=0;(position!=cursor.getCount())&&
> cursor.getCount()!=0;position++){
> String text=cursor.getString(0);
> int im=cursor.getInt(1);
> itla.addItem(new IconifiedText(text, getResources().getDrawable(im)));
> cursor.moveToNext();}
>
> setListAdapter(itla);
> [code]
>
> I am using getDatabasePath to connect to db
> Is this is the proper way to create as well as accessing the database?
>
> Please suggest...
>
> Regards
> Bharat.
--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to