Android : Error with loadUrl method

on Sunday, September 14, 2014


I'm building an app that shows two listviews. From the second one, by clicking on an item you get a webView of the file. The listviews work correct but I'm having a problem with the webView.


Here is my code:



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


public class WebView extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view);

Intent launchingIntent = getIntent();
String content = launchingIntent.getData().toString();

WebView viewer = **(WebView) findViewById(R.id.webView2);**
viewer.**loadUrl**(content);

}


Here is the .xml:



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.estudiable.estudiable.WebView">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView2"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>


Here is my question:


Why the bold sentences are underlined in red in my code?


While trying to compile it says this:



Error:(20, 53) error: cannot find symbol variable estudiableWebView
Error:(21, 15) error: cannot find symbol method loadUrl(String)


Thank you!


0 comments:

Post a Comment