android - BitmapFactory.decodeFile in asset doesn't work (FileNotFindException) -


i don't know why decodefile doesn't work when param point file inside asset folder.

     // load images file path     string[] dir = null;     try {         dir = genericmaincontext.sharedcontext.getassets().list("drawable");        // dir log => [ic.png, ic_info_dark.png, ic_launcher_default.png]     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }      (string uri : dir){          // stuff here         if (uri!=null) {             bitmap bitmap = null;             try {                 bitmap = bitmapfactory.decodefile("file:///android_asset/drawable/"+uri);               } catch (ioexception e) {                 // todo auto-generated catch block                 e.printstacktrace();             } 

any explanation ?

file:///android_asset/ used webview load assets. load assets programmatically use getassets() method returns assetmanager on context object such activity. open(filename) return inputstream asset file. following create bitmap asset file filename inside activity,

bitmapfactory.decodestream(getassets().open(filename)) 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -