Create bitmap of your image then
Bitmap bmp = BitmapFactory.decodeStream(new FileInputStream(f), null, null);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray = stream.toByteArray();
dba.open();
dba.insertPhoto(byteArray);
where dba is object of database class.
create table in database class like:
private static final String CREATETABLE_PHOTO = "create table eqpphoto("EImage BLOB " + ");";
public static final String TABLE_PHOTO = "eqpphoto";
public long insertPhoto(byte[] EImage) {
try {
System.out.println("Function call : ");
ContentValues values = new ContentValues();
values.put(EIMAGE, EImage);
return db.insert(TABLE_PHOTO, null, values);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}