Hi try to get the file from assets manager AssetManager asm =getAssets(); asm.open(name of the file)
Thanks Harsh On Sep 13, 6:33 am, Mark Murphy <mmur...@commonsware.com> wrote: > Just for grins, try all lowercase (shopping) instead of mixed case (Shopping). > > > > > > > > > > On Mon, Sep 12, 2011 at 11:55 AM, darrinps <darri...@gmail.com> wrote: > > I have an asset that I am trying to load in WebView. If the same file > > is read from the SD card, all works fine, but I cannot read it when > > packaged as an asset. > > > Here is the code > > > WebView webview = new WebView(this); > > > ((ViewGroup)findViewById(R.id.content)).addView(webview, 0); > > webview.getSettings().setJavaScriptEnabled(true); > > webview.setWebViewClient(new WebViewClient() > > { > > ... //code elided for brevity > > webview.loadUrl("file:///android_asset/Shopping/index.html"); > > } > > > This same code works fine if I use another html file if it isn't in > > its own directory. > > > For example, this works: > > webview.loadUrl("file:///android_asset/sample.html"); > > > Also, as stated above, if I read it from an SD card this all is OK. > > > For example, this also works: > > webview.loadUtl("content://com.android.htmlfileprovider/sdcard/ > > downloads/Shopping/index.html"); > > > The only think that doesn't work is when the thing is in its own > > directory it seems. Is packaging an asset inside its own directory a > > no no? I'd like to keep things tidy if possible, but if it cannot be > > done then I will remove the Shopping directory and plunk everything > > down under assets. > > > Thanks! > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en