shreyas
shreyas

Reputation: 2166

image from a file in android

i am using the following code to get a bitmap from a imagefile.

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)

but it returns a file not found exception even though the file exists. this is the image path used "file:/storage/emulated/0/Download/form_message_1.jpg"

Upvotes: 0

Views: 30

Answers (1)

greenapps
greenapps

Reputation: 11214

Remove 'file:' from that path and try again.

Upvotes: 1

Related Questions