Nitoo Nuckched
Nitoo Nuckched

Reputation: 55

Webview with intent filters

I am trying to create a webview but it's not showing up when I am running it.Can you help please.

The error I am having:

11-16 16:30:23.043: E/AndroidRuntime(1709): FATAL EXCEPTION: main
11-16 16:30:23.043: E/AndroidRuntime(1709): java.lang.RuntimeException: Unable to      start activity ComponentInfo{com.example.intents/com.example.intents.MyBrowserActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class webView

11-16 16:30:23.043: E/AndroidRuntime(1709): at Android.app.ActivityThread.performLaunchActivity(ActivityThread.Java:2059) 11-16 16:30:23.043: E/AndroidRuntime(1709): at Android.app.ActivityThread.handleLaunchActivity(ActivityThread.Java:2084)

This is my manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.intents"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
 android:minSdkVersion="8"
 android:targetSdkVersion="15" />
 <uses-permission android:name="android.permission.CALL_PHONE"/>
 <uses-permission android:name="android.permission.INTERNET"/>

 <activity
  android:name=".MyBrowserActivity"
  android:label="@string/app_name" >

  <intent-filter>
  <action android:name="android.intent.action.VIEW" />
   <action android:name="com.example.MyBrowser" />

   <category android:name="android.intent.category.DEFAULT" />
   <data android:scheme="http"/>
   </intent-filter>
   </activity>

Main Activity:

Button But4 = (Button)findViewById(R.id.btn_launchMyBrowser);
 But4.setOnClickListener(new View.OnClickListener(){

    public void onClick(View v) {
        // TODO Auto-generated method stub
        Intent i = new Intent("com.example.MyBrowser");
        i.setData(Uri.parse("http://www.amazon.com"));
        startActivity(i);


    }


 });

My Intent Activity:

           Uri url = getIntent().getData();
    WebView webView = (WebView)findViewById(R.id.WebView01);
    webView.setWebViewClient(new Callback());
    webView.loadUrl(url.toString());
}
private class Callback extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url){
        return (false);
    }
}

Upvotes: 0

Views: 1928

Answers (1)

brillenheini
brillenheini

Reputation: 5453

Error inflating class webView

My guess is that you typed webViewin your layout file instead of WebView.

Upvotes: 1

Related Questions