开发者

How do I access local web pages on the Android?

开发者 https://www.devze.com 2023-01-04 05:42 出处:网络
I have some web pages that I want to bundle with my Android application and display as static pages.Where do I put them?How do I access them?I\'m working in Eclipse, so I want a solution that automati

I have some web pages that I want to bundle with my Android application and display as static pages. Where do I put them? How do I access them? I'm working in Eclipse, so I want a solution that automatically bundles them.

I've tr开发者_StackOverflow社区ied putting my web pages in res/raw, and I can read them as an input stream from there, so I could push that into a WebView. But I'd really prefer if I could stick them somewhere and access them with a URL. I've tried file:///android_asset/about.html but that didn't work. Surely there's a way to form a URL to display bundled pages.


Put them into the "assets" folder and do:

webview.loadUrl("file:///android_asset/file.html");
0

精彩评论

暂无评论...
验证码 换一张
取 消