2011-04-30 7 views
0

ウェブページを表示するためにwebviewを試しましたが、私のアプリケーションが予期せず停止する大きな問題に直面しました。私は何度も試しましたが、同じエラーを示しました。Android webviewがうまくいかない、助けてください

エラーは "WebViewのアプリが予期せず(プロセスnet.webview)を停止..." である

私のJavaコード:

Code: 
import android.app.Activity; 
import android.os.Bundle; 
import android.webkit.WebView; 

public class MyWebView extends Activity { 
    /** Called when the activity is first created. */ 

    WebView mWebView; 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
     mWebView = (WebView) findViewById(R.id.webview); 
     mWebView.getSettings().setJavaScriptEnabled(true); 
     mWebView.loadUrl("http://www.google.com"); 
    } 
} 

私のXMLレイアウト:

Code: 
<?xml version="1.0" encoding="utf-8"?> 

<WebView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/webview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
/> 

マイマニフェストファイル:

Code: 
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="net.WebView" 
     android:versionCode="1" 
     android:versionName="1.0"> 
    <uses-sdk android:minSdkVersion="7" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
    <application android:icon="@drawable/icon" android:label="@string/app_name"> 
     <activity android:name=".WebView" 
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.NoTitleBar"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

    </application> 
</manifest> 

答えて

3

マニフェスト内のあなたのアクティビティの名前が間違っています。次のようになります。

<activity android:name=".MyWebView" 
       android:label="@string/app_name" 
       android:theme="@android:style/Theme.NoTitleBar"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
+0

ありがとうございました。あなたは私の救い主です。私はそれのために一日を過ごした。よい休日を。 – lovesunset21

+0

ようこそ。それがあなたの質問/問題に答えるなら、左側の緑色の目盛りサインにチェックを入れてください(私は思う)。 – ccheneson

関連する問題