I have a requirement to check whether preexisting data base is present in my application or not for that I have written following code.
public boolean checkDataBase(){
SQLiteDatabase checkDB = null;
try {
String myPath = "/data/data/com.mycomp.sampleapp/databases/myDB.db";
checkDB = SQLiteDatabase.openDatabase(myPath, null,SQLiteDatabase.OPEN_READWRITE);
}
catch (Exception e) { }
}
The above code working as expected . Now my problem is that it is printing below exception statements in my Logcat. I just want to do nothing and dont want to print exception in my Logcat.
E/SQLiteDatabase(27655): Failed to open database '/data/data/com.mycomp.sampleapp/databases/myDB.db'.
E/SQLiteDatabase(27655): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:338)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:232)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:512)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:206)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:178)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:885)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:855)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
E/SQLiteDatabase(27655): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:671)
I have written my code in try/catch block , but still its printing exception in my log files.
Please let me know how to prevent printing exception in log files.
0 comments:
Post a Comment