Opening a File from assets folder in android

These Lines are working perfectly– InputStream assetInStream=null; try { assetInStream=getAssets().open(“icon.png”); Bitmap bit=BitmapFactory.decodeStream(assetInStream); img.setImageBitmap(bit); } catch (IOException e) { e.printStackTrace(); } finally { if(assetInStream!=null) assetInStream.close(); } If your image is very big then you should scale your image before decoding it into Bitmap. See How to display large image efficiently

Loading existing .html file with android WebView

ok, that was my very stupid mistake. I post the answer here just in case someone has the same problem. The correct path for files stored in assets folder is file:///android_asset/* (with no “s” for assets folder which i was always thinking it must have a “s”). And, mWebView.loadUrl(“file:///android_asset/myfile.html”); works under all API levels. I … Read more