The class "AssetManager" can open an inputstream from the folder
"assets".
Well, Which class can open an outputstream from it?

Thx,
Amon


On 9月13日, 下午4时37分, endyk <[email protected]> wrote:
> hello,
>
> may be you should use function load data with base url where your
> assets placed
>
> webview.loadDataWithBaseURL("file:///android_asset/
> Shopping/", .......
>
> On Sep 12, 10:55 pm, darrinps <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to