获取图像字节

时间:2014-04-10 16:54:12

标签: android image

您好我正在使用此代码从图库中选择图片:

            Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);                          
            startActivityForResult(i, LOAD_IMAGE_RESULTS);


     if (requestCode == LOAD_IMAGE_RESULTS && resultCode == RESULT_OK && data != null) 
        {

            Uri pickedImage = data.getData();
            String[] filePath = { MediaStore.Images.Media.DATA };
            Cursor cursor = getContentResolver().query(pickedImage, filePath, null, null, null);
            cursor.moveToFirst();
            String imagePath = cursor.getString(cursor.getColumnIndex(filePath[0]));                           
            image.setImageBitmap(BitmapFactory.decodeFile(imagePath));      
            cursor.close();
        }

但我不确定它是否给我这个图像的字节大小,我需要这个选中图像的字节大小。请帮忙!

0 个答案:

没有答案