BitmapFactory: Unable to decode stream: java.io.FileNotFoundException even when file IS actually there

前端 未结 4 1828
刺人心
刺人心 2021-01-02 04:28

I\'m creating a simple app to take a picture. this is my code

Button b1;
ImageView iv;
String TAG = \"MAIN ACTIVITY\";

File photo;
private Uri mImageUri;


         


        
4条回答
  •  甜味超标
    2021-01-02 05:08

    Use BitmapFactory.decodeStream instead of BitmapFactory.decodeFile.

    try ( InputStream is = new URL( file_url ).openStream() ) {
      Bitmap bitmap = BitmapFactory.decodeStream( is );
    }
    

    Source https://stackoverflow.com/a/28395036/5714364

提交回复
热议问题