I have an Android app which includes an activity called Help This uses a WebView to display the help content in HTML format. Thie activity can be invoked two ways: either passing a URL, or direct text content. The only URL that I ever pass to this is “file:///android_asset/help/index.html” (which is an HTML page included in my assets in the APK).
Passing the URL works fine on my HTC Desire running Android 2.2. It also seems to work in an emulator running Android 3.0. However, when I try it in an emulator with Android 4.0, it seems to try to launch the Web browser instead, to display a blank page; when I close this, I am back in my Help activity, also showing a blank page.
Passing direct text content works fine on all the versions I’ve tried. The WebView documentation says “Note that, in order for your Activity to access the Internet and load web pages in a WebView, you must add the INTERNET permissions to your Android Manifest file:” But I have no need to access the Internet as such, I just want to display my app-internal help page. And this has worked on Android versions prior to 4.0.
Is this a bug in Android 4? Or is it just something I’ve misunderstood? Thanks for any help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…