java.lang.IllegalArgumentException:空值
java.lang.IllegalArgumentException: Empty values
错误
FATAL EXCEPTION: main
Process: com.appmaster.akash.messageplus, PID: 6468
java.lang.IllegalArgumentException: Empty values
at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1545)
at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1525)
at com.appmaster.akash.messageplus.Chat.onDataChange(Chat.java:783)
at com.google.android.gms.internal.zzduz.zza(Unknown Source:13)
at com.google.android.gms.internal.zzdwu.zzbvb(Unknown Source:2)
at com.google.android.gms.internal.zzdxa.run(Unknown Source:65)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
12-19 15:11:35.658 1957-2011/system_process E/memtrack: Couldn't load memtrack module
代码
if(mSeen!=null && mSeen.equals("No")) {
if (mTime < seen)
contentValues.put(KEY_SEEN, "Yes"); //Change the value of newData(which is actually your old value) by incrementing
long returnVariable = db.update(TABLE_CHAT_DATA, contentValues, null, null);
if (returnVariable == -1) {
Toast.makeText(getApplication(), "Nope", Toast.LENGTH_LONG).show();
//-1 means there was an error updating the values
} else {
Toast.makeText(getApplication(), "SEEEEEEN", Toast.LENGTH_SHORT).show();
}
}
错误出现在更新行上...我不明白这一点,因为数据就在那里,但仍然显示空值。有人可以帮帮我吗
将第一个 if 语句的内容括起来。缺少括号,因此第二行始终执行,无论 if 是什么(我假设您没有提前为 contentValues 输入值)。
if (mTime < seen) { //// HERE
contentValues.put(KEY_SEEN, "Yes"); //Change the value of newData(which is actually your old value) by incrementing
long returnVariable = db.update(TABLE_CHAT_DATA, contentValues, null, null);
} /// AND HERE
if (returnVariable == -1) {
Toast.makeText(getApplication(), "Nope", Toast.LENGTH_LONG).show();
//-1 means there was an error updating the values
} else {
Toast.makeText(getApplication(), "SEEEEEEN", Toast.LENGTH_SHORT).show();
}
错误
FATAL EXCEPTION: main
Process: com.appmaster.akash.messageplus, PID: 6468
java.lang.IllegalArgumentException: Empty values
at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1545)
at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1525)
at com.appmaster.akash.messageplus.Chat.onDataChange(Chat.java:783)
at com.google.android.gms.internal.zzduz.zza(Unknown Source:13)
at com.google.android.gms.internal.zzdwu.zzbvb(Unknown Source:2)
at com.google.android.gms.internal.zzdxa.run(Unknown Source:65)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
12-19 15:11:35.658 1957-2011/system_process E/memtrack: Couldn't load memtrack module
代码
if(mSeen!=null && mSeen.equals("No")) {
if (mTime < seen)
contentValues.put(KEY_SEEN, "Yes"); //Change the value of newData(which is actually your old value) by incrementing
long returnVariable = db.update(TABLE_CHAT_DATA, contentValues, null, null);
if (returnVariable == -1) {
Toast.makeText(getApplication(), "Nope", Toast.LENGTH_LONG).show();
//-1 means there was an error updating the values
} else {
Toast.makeText(getApplication(), "SEEEEEEN", Toast.LENGTH_SHORT).show();
}
}
错误出现在更新行上...我不明白这一点,因为数据就在那里,但仍然显示空值。有人可以帮帮我吗
将第一个 if 语句的内容括起来。缺少括号,因此第二行始终执行,无论 if 是什么(我假设您没有提前为 contentValues 输入值)。
if (mTime < seen) { //// HERE
contentValues.put(KEY_SEEN, "Yes"); //Change the value of newData(which is actually your old value) by incrementing
long returnVariable = db.update(TABLE_CHAT_DATA, contentValues, null, null);
} /// AND HERE
if (returnVariable == -1) {
Toast.makeText(getApplication(), "Nope", Toast.LENGTH_LONG).show();
//-1 means there was an error updating the values
} else {
Toast.makeText(getApplication(), "SEEEEEEN", Toast.LENGTH_SHORT).show();
}