I am storing my images in drawable and their resource id in SQLite database.My database is created when the application starts for the first time.
Is it good to save
It is Bad idea to store ids, But what is your purpose?? better idea is to store thumbnails to database rather than ids.. this helped me may this example help you do following steps
get thumbnails of your image
final int thumbnailSize = 128;// define your size
Bitmap ThumbImage = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(imagePath), THUMBSIZE, THUMBSIZE);
Convert it into Byte array
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.thumbnail); ByteArrayOutputStream out = new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.PNG, 100, out); byte[] buffer=out.toByteArray();
Save it as Blob
ContentValues cv=new ContentValues(); cv.put(CHUNK, buffer); //CHUNK blob type field of your table long rawId=database.insert(TABLE, null, cv); //TABLE table name
I havnt used this but this may help you