Reputation: 19484
The documentation says if BitmapFactory.decodeFile (filename, options) can't be decoded, it will return null. However, it always returns null if the flag inJustDecodeBounds is true.
In my simple test case, I pass in a bad file name: file doesn't exist. The only indication I can see that it failed is it sets options with outHeight and outWidth = 0.
A couple things I can do:
Aside from that, is there a correct way to check if decodeFile() worked?
Upvotes: 0
Views: 595
Reputation: 654
I guess you're passing an instance of BitmapFactory.Options
as second parameter. In that case, if the file does not exist, the options param is not updated. That's why you will have outWidth and outHeight = 0
Upvotes: 1