我有这段代码
webView.loadUrl( “文件:android_asset / index.html中”);
并且有效,但当我按下该页面内的重定向按钮到其他页面时不起作用,并且发生此错误:
01-14 18:31:42.962: D/FeatureProxyBase(11179): FeatureProxyBase class constructor
01-14 18:31:42.962: D/MultiWindow(11179): MultiWindowProxy constructor.
01-14 18:31:42.962: D/FeatureProxyBase(11179): getService(), serviceName = multiwindow_service_v1
01-14 18:31:43.073: D/Surface(11179): Surface::setBuffersDimensions(this=0x7fa5a0c600,w=480,h=854)
01-14 18:31:43.079: D/cr_Ime(11179): [AdapterInputConnection.java:499] finishComposingText
01-14 18:31:43.080: D/cr_Ime(11179): [AdapterInputConnection.java:145] Constructor called with outAttrs: inputType=0xa1 imeOptions=0x12000000 privateImeOptions=null
01-14 18:31:43.080: D/cr_Ime(11179): actionLabel=null actionId=0
01-14 18:31:43.080: D/cr_Ime(11179): initialSelStart=0 initialSelEnd=0 initialCapsMode=0x0
01-14 18:31:43.080: D/cr_Ime(11179): hintText=null label=null
01-14 18:31:43.080: D/cr_Ime(11179): packageName=com.smartatx.smartatx fieldId=2131296362 fieldName=null
01-14 18:31:43.080: D/cr_Ime(11179): extras=null
01-14 18:31:43.080: V/InputMethodManager(11179): START INPUT: android.webkit.WebView{d7d7835 VFEDHVC. .F...... 0,0-480,816 #7f09006a app:id/webView1} ic=org.chromium.content.browser.input.AdapterInputConnection@31e9c745 tba=android.view.inputmethod.EditorInfo@1f9f0e9a controlFlags=#100
01-14 18:31:43.109: D/cr_Ime(11179): [ImeAdapter.java:571] focusedNodeChanged
01-14 18:31:43.146: D/FeatureProxyBase(11179): FeatureProxyBase class constructor
01-14 18:31:43.146: D/MultiWindow(11179): MultiWindowProxy constructor.
01-14 18:31:43.146: D/FeatureProxyBase(11179): getService(), serviceName = multiwindow_service_v1
01-14 18:31:43.148: W/System.err(11179): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///android_asset/register.html }
01-14 18:31:43.149: W/System.err(11179): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1792)
01-14 18:31:43.149: W/System.err(11179): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
01-14 18:31:43.149: W/System.err(11179): at android.app.Activity.startActivityForResult(Activity.java:3810)
01-14 18:31:43.149: W/System.err(11179): at android.app.Activity.startActivityForResult(Activity.java:3761)
01-14 18:31:43.149: W/System.err(11179): at android.app.Activity.startActivity(Activity.java:4091)
01-14 18:31:43.149: W/System.err(11179): at android.app.Activity.startActivity(Activity.java:4059)
01-14 18:31:43.149: W/System.err(11179): at com.smartatx.smartatx.MainActivity$MyWebViewClient.shouldOverrideUrlLoading(MainActivity.java:555)
01-14 18:31:43.149: W/System.err(11179): at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:325)
01-14 18:31:43.149: W/System.err(11179): at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:266)
01-14 18:31:43.149: W/System.err(11179): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
01-14 18:31:43.149: W/System.err(11179): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:37)
01-14 18:31:43.149: W/System.err(11179): at android.os.Handler.dispatchMessage(Handler.java:111)
01-14 18:31:43.149: W/System.err(11179): at android.os.Looper.loop(Looper.java:194)
01-14 18:31:43.149: W/System.err(11179): at android.app.ActivityThread.main(ActivityThread.java:5624)
01-14 18:31:43.149: W/System.err(11179): at java.lang.reflect.Method.invoke(Native Method)
01-14 18:31:43.149: W/System.err(11179): at java.lang.reflect.Method.invoke(Method.java:372)
01-14 18:31:43.149: W/System.err(11179): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
01-14 18:31:43.149: W/System.err(11179): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
01-14 18:31:43.151: A/chromium(11179): [FATAL:jni_android.cc(249)] Check failed: false. Please include Java exception stack in crash report
01-14 18:31:43.377: W/google-breakpad(11179): ### ### ### ### ### ### ### ### ### ### ### ### ###
01-14 18:31:43.377: W/google-breakpad(11179): Chrome build fingerprint:
01-14 18:31:43.377: W/google-breakpad(11179): 1.0.1
01-14 18:31:43.377: W/google-breakpad(11179): 2
01-14 18:31:43.377: W/google-breakpad(11179): a676bfac-134d-4bba-afb0-8168d5e1844b
我怎么能解决这个问题,有什么建议?
我想要做的是在资源文件夹应用程序中有一个Web应用程序来浏览webview并且只使用外部服务器的php文件。
抱歉我的英语。
答案 0 :(得分:1)
阅读内容Html文件并使用它:
webView.loadDataWithBaseURL(null, *contentHtml* ,"text/html", "utf-8", null);