android webview fileassets,Android webview loadurl(“file:///android_asset/index.html#home”) failed...

问题

I am working on an application in Android, where I want to load a local html file using

webview.loadurl("file:///android_asset/index.html#home");

It will load ok on most devices, but on some Samsung devices with Android OS 4.0.4 , it load fails.

Do you have ideas with this issue?

Add some comments and sorry for my mistake just now.

webview.loadurl("file:///android_asset/www/index.html");

work fine , but

webview.loadurl("file:///android_asset/www/index.html#home");

failed .

回答1:

First check that index.html is under asset folder in your project folder.

I believe it is under www folder within asset folder of your project.

1:First put index.html under www folder

2:put the www folder within asset folder and call

webview.loadurl("file:///android_asset/www/index.html");

Edited:

I think you might want to call the home tab of the index.html every-time when you will run the application.

As android is only concern of the html pages not the tabs here is a good way which may help you i.e.

Set the home tab active of your index.html and make other inactive.

This will might help you.

回答2:

this is what happen to me i misspelled it make sure you typed correctly

file://android_asset/www/index.html

not as "assets"

来源:https://stackoverflow.com/questions/19857225/android-webview-loadurlfile-android-asset-index-htmlhome-failed

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值