2015-02-10 47 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:',然後重試。