I am trying to identify SQLite column data types and I do not know how to check if the number in column is long
or int
or also if the number is float
or double
.
Cursor c;
Object val;
int type = c.getType(i);
if(type == Cursor.FIELD_TYPE_BLOB){
val = c.getBlob(i);
}else if(type == Cursor.FIELD_TYPE_FLOAT){
val = c.getFloat(i);
}else if(type == Cursor.FIELD_TYPE_INTEGER){
val = c.getInt(i);
}else if(type == Cursor.FIELD_TYPE_LONG){ //this here is the problem. "Cursor.FIELD_TYPE_LONG" does not exists
val = c.getLong(i);
} else if(type == Cursor.FIELD_TYPE_NULL){
val = null;
}else if(type == Cursor.FIELD_TYPE_STRING){
val = c.getString(i);
}
Aucun commentaire:
Enregistrer un commentaire