2013年11月27日 星期三

[Android] added create image from InputStream


InputStream is = null;
try {
  is = this.getResources().getAssets().open("Images/Fruits/Apple.png");
} catch (IOException e) {
  Log.w("EL", e);
}
Bitmap image = BitmapFactory.decodeStream(is);
ImageButton ib2 = (ImageButton) findViewById( R.id.imageButton2);
ib2.setImageBitmap( image);

沒有留言:

張貼留言