2015-02-10 36 views
0

我正在使用以下代码从图像文件中获取位图。图像来自android中的文件

BitmapFactory.Options options = new BitmapFactory.Options(); 
     options.inPreferredConfig = Bitmap.Config.ARGB_8888; 
    Bitmap bitmap = BitmapFactory.decodeFile(requestPackage.getPics().get(i), options); 
      ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
      bitmap.compress(Bitmap.CompressFormat.PNG,60,baos) 

但即使文件存在,它也会返回文件未找到异常。 这是使用的图像路径"file:/storage/emulated/0/Download/form_message_1.jpg"

回答

1

从该路径中删除'file:',然后重试。