over 7 years ago
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inJustDecodeBounds = true;

Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.imageid, opts);
int w = opts.outWidth;
int h = opts.outHeight;
  • inJustDecodeBounds 要設為 true,才不會將圖檔讀到記憶體中。
← Make Permanent Alias on Mac OS [MySQL] 錯誤整理 →
 
comments powered by Disqus