我能够获得的图像的高度和宽度。但有一个检索的大小(以字节为单位或KB或MB),用于存储在手机图像的方法?
I'm able to get the height and width of an image. But is there a method to retrieve the size (in bytes or kb or mb) for an image stored in the phone?
感谢您的答案。这就是我终于解决了它:
Thank you for your answers. This is how I finally resolved it:
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
R.drawable.ic_launcher);
Bitmap bitmap = bitmapOrg;
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] imageInByte = stream.toByteArray();
long lengthbmp = imageInByte.length;
鸭preciate您的时间和答案:)
Appreciate your time and answers :)