[android-developers] Re: problem of creating SQLite database on SDCard
Kosyta The error is fixed. Thank you for your help! Kenneth On Jul 12, 5:39 pm, Kostya Vasilyev kmans...@gmail.com wrote: Kenneth, Does your app have WRITE_EXTERNAL_STORAGE permission? -- Kosyta 12.07.2010 13:21, Kenneth WON пишет: Dear all, I want to create a database storing on the SDCard, but there is error occurred. The following is the error: ERROR/Database(605): sqlite3_open_v2(/sdcard/LyodsGPS.sqlite, handle, 6, NULL) failed ERROR/AndroidRuntime(605): Caused by: android.database.sqlite.SQLiteException: unable to open database file And I want to ask what it is? What can I do to solve it? Thank you! -- Kostya Vasilev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- 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
[android-developers] Re: Problem with the sqlite database
If you close your connection in onPause, wouldn't you need to open it again in onResume? On Dec 13, 6:08 pm, Paul paul_rash...@yahoo.com wrote: In order to play nicely with the resources you share with other applications I think you might want to consider creating your connection in onCreate, and cleaning it up in onPause. You mentioned an issue when you tried that earlier but it might be worth resolving within your app. This will keep your connection open to the database for only the amount of time when your application is actually being viewed (i think). http://code.google.com/android/reference/android/app/Activity.html On Dec 13, 5:02 pm, thisnameagain micah...@gmail.com wrote: I cleared up my problem with the SQL not closing and creating aleak by make sure to close the connection in onDestroy. I had tried to close the connection earlier, but that caused a different problem. When I close it in onDestroy everything works well. Hope that might help someone. On Dec 13, 5:47 pm, thisnameagain micah...@gmail.com wrote: Wondering if you ever solved this? I am getting a similar problem and I have notfoundanything 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):Leakfound 11-24 19:27:38.287: ERROR/Database(5891): java.lang.IllegalStateException: /data/data/com.vista.examples.List/databases/ev_dataSQLiteDatabasecreated andneverclosed 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() { SQLiteDatabasevDB=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 -~--~~~~--~~--~--~---
[android-developers] Re: Problem with the sqlite database
yep, I miss-spoke. onResume is what I use. On Dec 17, 4:46 pm, filbert filbert...@gmail.com wrote: If you close your connection in onPause, wouldn't you need to open it again in onResume? On Dec 13, 6:08 pm, Paul paul_rash...@yahoo.com wrote: In order to play nicely with the resources you share with other applications I think you might want to consider creating your connection in onCreate, and cleaning it up in onPause. You mentioned an issue when you tried that earlier but it might be worth resolving within your app. This will keep your connection open to the database for only the amount of time when your application is actually being viewed (i think). http://code.google.com/android/reference/android/app/Activity.html On Dec 13, 5:02 pm, thisnameagain micah...@gmail.com wrote: I cleared up my problem with the SQL not closing and creating aleak by make sure to close the connection in onDestroy. I had tried to close the connection earlier, but that caused a different problem. When I close it in onDestroy everything works well. Hope that might help someone. On Dec 13, 5:47 pm, thisnameagain micah...@gmail.com wrote: Wondering if you ever solved this? I am getting a similar problem and I have notfoundanything 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):Leakfound 11-24 19:27:38.287: ERROR/Database(5891): java.lang.IllegalStateException: /data/data/com.vista.examples.List/databases/ev_dataSQLiteDatabasecreated andneverclosed 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() { SQLiteDatabasevDB=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 -~--~~~~--~~--~--~---
[android-developers] Re: Problem with the sqlite database
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 -~--~~~~--~~--~--~---
[android-developers] Re: Problem with the sqlite database
I cleared up my problem with the SQL not closing and creating a leak by make sure to close the connection in onDestroy. I had tried to close the connection earlier, but that caused a different problem. When I close it in onDestroy everything works well. Hope that might help someone. On Dec 13, 5:47 pm, thisnameagain micah...@gmail.com wrote: Wondering if you ever solved this? I am getting a similar problem and I have notfoundanything 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):Leakfound 11-24 19:27:38.287: ERROR/Database(5891): java.lang.IllegalStateException: /data/data/com.vista.examples.List/databases/ev_dataSQLiteDatabasecreated andneverclosed 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() { SQLiteDatabasevDB=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 -~--~~~~--~~--~--~---
[android-developers] Re: Problem with the sqlite database
In order to play nicely with the resources you share with other applications I think you might want to consider creating your connection in onCreate, and cleaning it up in onPause. You mentioned an issue when you tried that earlier but it might be worth resolving within your app. This will keep your connection open to the database for only the amount of time when your application is actually being viewed (i think). http://code.google.com/android/reference/android/app/Activity.html On Dec 13, 5:02 pm, thisnameagain micah...@gmail.com wrote: I cleared up my problem with the SQL not closing and creating a leak by make sure to close the connection in onDestroy. I had tried to close the connection earlier, but that caused a different problem. When I close it in onDestroy everything works well. Hope that might help someone. On Dec 13, 5:47 pm, thisnameagain micah...@gmail.com wrote: Wondering if you ever solved this? I am getting a similar problem and I have notfoundanything 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):Leakfound 11-24 19:27:38.287: ERROR/Database(5891): java.lang.IllegalStateException: /data/data/com.vista.examples.List/databases/ev_dataSQLiteDatabasecreated andneverclosed 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() { SQLiteDatabasevDB=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 -~--~~~~--~~--~--~---