SQLiteDiskIOException on the device but not on PC - eclipse
Hello android developers,
I was struggling to get this work but failed and now want to have your advice for this bug. What the problem is I use the 'update' method from the 'SQLiteDabase' library and it does NOT ONLY work on the actual device.
The weird thing is it has no problem on the eclipse android emulator but only on actual devices. If anyone knows how to figure this out or have an advice, would you please help me? I really appreciate your any help for this question. Below codes are my method and error messages.
public void updateDBMessages(int column_no, String key, Object value){
SQLiteDatabase db = getWritableDatabase();
ContentValues table_value = new ContentValues();
if(value.getClass().equals(String.class)){
table_value.put(key, value.toString());
}
else if (value.getClass().equals(Integer.class)){
table_value.put(key, (Integer)value);
}
// THE ERROR HAPPENS ON THIS COMMAND!!
db.update(VM_TABLE_NAME, table_value, "_id="+column_no, null);
}
[Error message LOG]
07-05 08:10:39.721: ERROR/AndroidRuntime(10295): FATAL EXCEPTION: main 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): android.database.sqlite.SQLiteDiskIOException: error code 10: disk I/O error 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): at android.database.sqlite.SQLiteStatement.native_execute(Native Method) 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61) 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1727) 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1656) 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): at ca.slipline.android.asterdroid.VoiceMailScreen.updateDBMessages(VoiceMailScreen.java:607) 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): at ca.slipline.android.asterdroid.VoiceMailScreen.access$9(VoiceMailScreen.java:594) 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): at ca.slipli开发者_运维知识库ne.android.asterdroid.VoiceMailScreen$3.onClick(VoiceMailScreen.java:482) 07-05 08:10:39.721: ERROR/AndroidRuntime(10295): at android.view.View.performClick(View.java:2501)
Looks like you're trying to update record with conflict. You should either revise your update
statement (check where clause or field types and so on) or just use updateWithOnConflict
I found the solution. It was a sort of Android itself problem so I simply changed the 'update' method to 'execSQL' in order to update it manually with a SQL command 'UPDATE'.
精彩评论