Hi, in my project I need to handle an exception such as a repeating value, an empty field, etc. I was thinking about using the try catch method for this
public void deleteRegisterID(Object object) {
SQLiteDatabase oDBLocal = this.getWritableDatabase();
try {
oDBLocal.execSQL("delete from " + STRTABLE_REGISTER + " where " + KEY_ID
+ " = " + object + ";");
}catch (SQLException mSQLException) {
Log.e("Loginerror", "getproductData >>" + mSQLException.toString());
throw mSQLException;
}
}
I can get an error, but I need to process it and send a message to the user to log in again, so although I do it using this
catch (SQLException mSQLException)
{
switch (mSQLException.getErrorCode ())
{
case 19:
break;
case 11:
break;
default:
throw mSQLException;
}
}
but there is no method like getErrorCode()in SQLException when I check mSQLException., but it is in the android document. Can anybody help me.
source
share