android - Catching BitmapFactory exceptions -
i trying load bitmap file using bitmapfactory class shown:
bitmap b = bitmapfactory.decodefile(getactivity().getfilesdir() + "/myimage.jpg");
this works fine except in instances file not exist on filesystem , throws java.io.filenotfoundexception (no such file or directory). question is, how grab exception , maintain going? have surrounded statement in seek block grab statement says never reached filenotfoundexception. taking @ bitmapfactory class shows doesn't throw exceptions. doing wrong here?
try explicitly define right exception
try{ bitmap b = bitmapfactory.decodefile(getactivity().getfilesdir() + "/myimage.jpg"); }catch(java.io.filenotfoundexception ex){ //caught exception }
android exception bitmapfactory
No comments:
Post a Comment