Skip to content Skip to sidebar Skip to footer

Cannot Find Symbol Method Loadurl(string)

I am new to Android Studio. When I try to make this project it throws me the error: Cannot find symbol method loadUrl(String) in the MainActivity.java. The loadUrl is highlighted

Solution 1:

You have to add a WebView object like this:

In your layout.xml

<?xml version="1.0" encoding="utf-8"?><WebViewxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/webview"android:layout_width="fill_parent"android:layout_height="fill_parent"
/>

Then in MainActivity.java use this:

WebViewwebViewer= (WebView) findViewById(R.id.webview);
webView.loadUrl("file:///android_asset/www/index.html");

Obviously you have to add permission

<uses-permissionandroid:name="android.permission.INTERNET" />

Read this WebView for a better explanation

If you want to use super.loadUrl(String) you have to import org.apache.cordova.*, read this PhoneGap API

Post a Comment for "Cannot Find Symbol Method Loadurl(string)"