hai developers, i had attached my code to store the image in database.after i run my code ,the emulater have the blank screen.no images display in emulator.anyone can help me ,what is the wrong in the code.why the image dispaly in emulator?otherwise is there any other method have to get the image from database.help me to solve my problem.
public class imagedatabase extends Activity { private final String MY_DATABASE_NAME = "WalletZarr"; private final String MY_DATABASE_TABLE = "mytable"; public void onCreate(Bundle icicle) { super.onCreate(icicle); SQLiteDatabase myDB = null; try { myDB = this.openOrCreateDatabase(MY_DATABASE_NAME , MODE_PRIVATE,null); myDB.execSQL("CREATE TABLE IF NOT EXISTS " + MY_DATABASE_TABLE+"(image BLOB);"); Bitmap bmp1=BitmapFactory.decodeResource(getResources(), R.drawable.icon); ByteArrayOutputStream out = new ByteArrayOutputStream(); bmp1.compress(Bitmap.CompressFormat.PNG, 100, out); myDB.execSQL("INSERT INTO "+ MY_DATABASE_TABLE + "(image)" + " VALUES (\""+bmp1+"\");"); Cursor c = myDB.rawQuery("SELECT *" + " FROM " + MY_DATABASE_TABLE,null); int firstNameColumn=c.getColumnIndex("image"); if (c.moveToFirst()) { do { byte[] blob=c.getBlob(firstNameColumn); Bitmap bmp=BitmapFactory.decodeByteArray(blob,0,blob.length); ImageView image=new ImageView(this); image.setImageBitmap(bmp); } while (c.moveToNext()); } } catch (Exception e) { } finally { if (myDB != null) myDB.close(); }}} -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en