Jetzt kostenlos registrieren. Mitglieder surfen ohne Werbung auf Android-Hilfe.de!
Zurück   Android-Hilfe.de > Android Developer > Android App Entwicklung

HelloWebView ///R.id.webview klappt nicht

Das Thema "HelloWebView ///R.id.webview klappt nicht" befindet sich unter Android App Entwicklung auf Android-Hilfe.de.


Antwort

 

Themen-Optionen Ansicht
Alt 24.07.2011, 13:58   #1 (permalink)
Android-Hilfe.de Mitglied

Modell: HTC Desire & ASUS Transformer Prime 64 GB

Registriert seit: 23.07.2011
Beiträge: 195
Abgegebene Danke: 24
Erhielt 14 Danke für 12 Beiträge
kabummski eine Nachricht über ICQ schicken kabummski eine Nachricht über MSN schicken
Beitrag HelloWebView ///R.id.webview klappt nicht

Hallo ich nochmal.

Ich will jetzt die HelloWebView App Programmieren, doch er meckert bei "R.id.webview"

Habe schon einige Dinge ausprobiert, wahrscheinlich ist die Lösung auch ganz Leicht, doch ich komme nicht drauf -.-

HelloWebView.java
Zitat:
package com.example.hellowebview;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import com.example.hellowebview.R;


public class HelloWebView extends Activity {
WebView mWebView;
/** Called when the activity is first created. */
@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");
}
}
main.xml
Zitat:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
androidrientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

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

R.java
Zitat:
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/

package com.example.hellowebview;


public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
}
}

Warum kann ich nicht auf die R.java und somit auf "id" zugreifen?

Hier die fehlermeldung;
Zitat:
id cannot be resolved or is not a field

DANKE IM VORRAUS
kabummski ist offline   Mit Zitat antworten
Alt 24.07.2011, 20:22   #2 (permalink)
Fortgeschrittenes Mitglied

Modell: Samsung Galaxy S und Galaxy 5

Registriert seit: 31.03.2011
Beiträge: 480
Abgegebene Danke: 35
Erhielt 89 Danke für 73 Beiträge
Standard AW: HelloWebView ///R.id.webview klappt nicht

Dein main.xml ist kein valides XML-File. Wenn Du es nicht nachvollziehen kannst, lies noch ein wenig über XML.
JanF ist offline   Mit Zitat antworten
Alt 25.07.2011, 21:59   #3 (permalink)
Neuer Benutzer

Registriert seit: 08.02.2010
Beiträge: 6
Abgegebene Danke: 0
Erhielt 0 Danke für 0 Beiträge
Standard AW: HelloWebView ///R.id.webview klappt nicht

Hallo,

JanF hat recht.
So weit ich mich erinnere, muss jedes Tag geschlossen werden, z.B.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
androidrientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
...
</LinearLayout> <!-- Tag geschlossen -->
Die anderen Tags sollten auch "geschlossen werden".
coolsmile ist offline   Mit Zitat antworten
Alt 25.07.2011, 23:48   #4 (permalink)
Android Guru

Modell: T-Mobile G1, Nexus One, Samsung Galaxy Tab 10.1, Samsung Galaxy Nexus

Registriert seit: 04.05.2009
Beiträge: 1.599
Abgegebene Danke: 128
Erhielt 210 Danke für 193 Beiträge
Standard AW: HelloWebView ///R.id.webview klappt nicht

Zitat:
Zitat von coolsmile Beitrag anzeigen
Hallo,

JanF hat recht.
So weit ich mich erinnere, muss jedes Tag geschlossen werden, z.B.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
androidrientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
...
</LinearLayout> <!-- Tag geschlossen -->
Die anderen Tags sollten auch "geschlossen werden".
<DiesesTagSchließtSichSelbst />
Das ist gültig, allerdings ist da ein XML Element, dass 2 mal geschlossen wird. Das meinte JanF.
__________________
Follow/Add/Circle/Whatever me on Google+

Solitaire HD, ein Solitaire optimiert für Honeycomb.
the_alien ist offline   Mit Zitat antworten
Antwort

Stichworte
app, app entwicklung, entwicklung, hellowebview

Themen-Optionen
Ansicht


Ähnliche Themen

Thema Autor Forum Antworten Letzter Beitrag
Milestone - Fullwipe klappt nicht / Daten werden nicht gelöscht Olysses Root / Hacking / Modding für Motorola Milestone 4 21.07.2011 20:05
[Erledigt] Galaxy S bootet nicht mehr und neu flashen klappt nicht 88lochi Samsung Galaxy S (I9000) Forum 4 04.06.2011 18:47
SD-Karte nicht verfügbar / mobiles Netzwerk klappt nach einiger Zeit nicht mehr Asfaloth LG P990 Optimus Speed Forum 6 07.04.2011 21:14
OTA 72 klappt nicht segelfreund Root / Hacking / Modding für HTC Desire HD 15 01.01.2011 09:44
Transparente WebView funktioniert nicht richtig ko5tik Android App Entwicklung 1 11.11.2009 21:17




Du liest gerade: "HelloWebView ///R.id.webview klappt nicht" unter "Android App Entwicklung" auf Android-Hilfe.de.


Powered by vBulletin®
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
© Android-Hilfe.de 2012 - All rights reserved.