Webview - Classnotfoundexception

Asked

Viewed 317 times

-1

I’m creating the following canvas on

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/activities_fundo_cinza"
    android:orientation="vertical" >

<Webview
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

But I’m making the following mistake:

04-07 14:55:45.557: E/AndroidRuntime(1693): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.Webview" on path: DexPathList[[zip file "/data/app/br.test.apk"],nativeLibraryDirectories=[/data/app-lib/br.livetouch.synchro-2, /system/lib]]

1 answer

1

You need to rewrite Webview for Webview. Thus:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/activities_fundo_cinza"
    android:orientation="vertical" >

<WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

The tag name is used to load the class so it has to be exactly the same name.

As described in documentation.

In general, in vocabulary XML to declare interface elements follows the structure and naming convention of the classes and methods, where the elements and the element name correspond to the class and the attributes correspond to the methods. In fact, the correspondence is so direct that you can guess which attribute XML corresponds to which class method, or suppose which class corresponds to which element XML. However, note that not all vocabulary is identical. In some cases there is a slight difference in naming. For example, the element EditText has a text attribute that corresponds to EditText.setText()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.