我試圖創建一個簡單地啓動網站的應用程序。我得到的代碼顯示沒有錯誤,但當我運行它在Web測試的東西它的應用程序崩潰並顯示此錯誤消息。 「應用程序web視圖(進程com.webview)已意外停止,請重試。 任何幫助將apreciated。Webview意外停止問題
下面是我爲我的類代碼和我的清單。
package com.webview;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
public class WebViewActivity extends Activity {
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState)
{
final Activity mActivity = this;
super.onCreate(savedInstanceState);
// Adds Progrss bar Support
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main);
// Makes Progress bar Visible
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://google.com");
mWebView.setWebChromeClient(new WebChromeClient()
{
public void onProgressChanged(WebView view, int progress)
{
//Make the bar disappear after URL is loaded, and changes string to Loading...
mActivity .setTitle("Loading...");
mActivity .setProgress(progress * 100); //Make the bar disappear after URL is loaded
}
});
}
}
清單
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.webview"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".WebViewActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
</manifest>
調試器示出了該下面
[2012-02-09 13點57分18秒 - 模擬器]未知savevm部類型95
[2012-02-09 13時57分52秒 - web視圖] HOME可達設備 '模擬器-5554'
[2012-02-09 13時57分52秒 - web視圖]上傳web視圖。 APK到設備 '模擬器-5554'
[2012-02-09十三點57分52秒 - web視圖]安裝WebView.apk ...
[2012-02-09 13時58分14秒 - web視圖]成功!
[2012-02-09 13時58分14秒 - web視圖]上設備模擬器-5554
[2012-02-09 13點58分15秒 - web視圖]開始的活動com.webview.WebViewActivity ActivityManager:開始:意向{行動= android.intent.action.MAIN
貓= [android.intent.category.LAUNCHER] CMP = com.webview/.WebViewActivity}
請從logcat發佈錯誤&stacktrace。 – Pedantic 2012-02-09 19:53:52
我使用Eclypse和新的這一切。我不知道你要求什麼或如何找到它。 – CsharpBeginner 2012-02-09 19:56:15
[2012-02-09 13:57:18 - Emulator] Unknown savevm section type 95 – CsharpBeginner 2012-02-09 19:57:33