Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
632 views
in Technique[技术] by (71.8m points)

android - android_asset not working on Honeycomb?

I have a shipping Android application that displays occasional static webpages that are included in the assets folder. I have been displaying these programmatically like:

webView = new WebView(PKBDocument.KnowledgeBook.KBContext);
setContentView(webView);
webView.loadUrl("file:///android_asset/path/to the/file.html");

This works fine for API levels 3 - 9. I just recently received my shiny new Xoom and tried running the same app, and I get an error

The webpage at file:///android_asset/path/to%20the/file.html might be temporarily down or it may have moved permanently to a new web address

So, I started experimenting. The Honeycomb emulator displays these pages just fine, but my actual honeycomb device (running 3.0.1) consistently displays this error. I can read the webpage with AssetManager and then display it using loadDataWithBaseURL(), but then the image links in the web page don't load (presumably because it can't find the path to the image file).

Any idea what changed, and how to handle this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try removing the space. This project and this project both work fine on my XOOM.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...