how to check is image inserted to database in android -
I have a table in the database that has several rows and each row stores an image and some string
But there is no image in some line
I want to read the contents of this table in my Android app and if I do not present the image I show a default image
How can I check that image? Does present or not?
This is my code
private zeros sql_load_data () {byte] sick_pic = null; Cursor cur_row; SQLiteDatabase sqLiteDatabase = SQLiteDatabase.openDatabase (DatabasesHealer.DB_PATH + "/" + DatabaseHelper.dbidi, blank, contextMODE_PRIVATE); Try {DBH.openDataBase (); Cur_row = sqLiteDatabase.rawquery ("disease_name, disease_fick, disease, disease_reaction, disease_select from control pistilians where id =" + id, blank); Cur_row.moveToFirst (); Lbl_illness_name.setText (cur_row.getString (0)); Illness_pic = cur_row.getBlob (1); Imgviw_illence_pic.setImageBitmap (bitmapfile.ededabiterror (illness_peak, 0, disease_pk.lamp)); Lbl_illness_cause.setText (cur_row.getString (2)); Lbl_illness_sign.setText (cur_row.getString (3)); Lbl_illness_control.setText (cur_row.getString (4)); } Hold (exception e) {e.printStackTrace (); }}
if nothing is left then if (illness_pic == Blank)
should be enough to check.
The other possibility is to add a field HAS_IMAGE
and use it to check it. Set it to 1
when you do not delete the image and by saving or deleting 0
.
Comments
Post a Comment