Alexander R.
- Forum-Beiträge: 1.148
22.07.2010, 21:11:41 via Website
22.07.2010 21:11:41 via Website
Hallo ich habe 2 Edit Text Felder und 2 Buttons erzeugt nun sollen die Eingegebenen Daten aus den Feldern gelesen werden und in der webview als strings eingelesen und geöffnet werden leider funktioniert das nicht so es gibt beim klick auf "Suchen" einen FC und ich glaube nicht, dass er den Text ausliest..
Was mache ich falsch?
Layout
*.java
Was mache ich falsch?
Layout
1<?xml version="1.0" encoding="utf-8"?>
2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent">
5 <EditText
6 android:id="@+id/set"
7 android:layout_width="fill_parent"
8 android:layout_height="wrap_content"
9 android:background="@android:drawable/editbox_background"
10 android:hint="Set-ID"/>
11 <EditText
12 android:id="@+id/card"
13 android:layout_width="fill_parent"
14 android:layout_height="wrap_content"
15 android:background="@android:drawable/editbox_background"
16 android:layout_below="@id/set"
17 android:hint="Kartennummer"/>
18 <Button
19 android:id="@+id/search"
20 android:layout_width="wrap_content"
21 android:layout_height="wrap_content"
22 android:layout_below="@id/card"
23 android:layout_alignParentRight="true"
24 android:layout_marginLeft="10dip"
25 android:text="Suchen" />
26 <Button
27 android:layout_width="wrap_content"
28 android:layout_height="wrap_content"
29 android:layout_toLeftOf="@id/search"
30 android:layout_alignTop="@id/search"
31 android:text="Abbrechen" />
32</RelativeLayout>
2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent">
5 <EditText
6 android:id="@+id/set"
7 android:layout_width="fill_parent"
8 android:layout_height="wrap_content"
9 android:background="@android:drawable/editbox_background"
10 android:hint="Set-ID"/>
11 <EditText
12 android:id="@+id/card"
13 android:layout_width="fill_parent"
14 android:layout_height="wrap_content"
15 android:background="@android:drawable/editbox_background"
16 android:layout_below="@id/set"
17 android:hint="Kartennummer"/>
18 <Button
19 android:id="@+id/search"
20 android:layout_width="wrap_content"
21 android:layout_height="wrap_content"
22 android:layout_below="@id/card"
23 android:layout_alignParentRight="true"
24 android:layout_marginLeft="10dip"
25 android:text="Suchen" />
26 <Button
27 android:layout_width="wrap_content"
28 android:layout_height="wrap_content"
29 android:layout_toLeftOf="@id/search"
30 android:layout_alignTop="@id/search"
31 android:text="Abbrechen" />
32</RelativeLayout>
*.java
1package de.CardSearch;
2
3import android.app.Activity;
4import android.os.Bundle;
5import android.view.View;
6import android.webkit.WebView;
7import android.widget.Button;
8
9public class CardSearch extends Activity {
10 private final String Set = "http://etcg.de/yugioh/karten-suchmaschine/yugioh_card-details.php?set=";
11 private final String Number = "&no=";
12 private final String Lang = "&la=de";
13 private WebView webview;
14 /** Called when the activity is first created. */
15 @Override
16 public void onCreate(Bundle savedInstanceState) {
17 super.onCreate(savedInstanceState);
18 setContentView(R.layout.main);
19
20 final Button button = (Button) findViewById(R.id.search);
21 button.setOnClickListener(new View.OnClickListener() {
22 public void onClick(View v) {
23 webview.loadUrl(Set+R.id.set+Number+R.id.card+Lang);
24 }
25 });
26 }
27
28}
2
3import android.app.Activity;
4import android.os.Bundle;
5import android.view.View;
6import android.webkit.WebView;
7import android.widget.Button;
8
9public class CardSearch extends Activity {
10 private final String Set = "http://etcg.de/yugioh/karten-suchmaschine/yugioh_card-details.php?set=";
11 private final String Number = "&no=";
12 private final String Lang = "&la=de";
13 private WebView webview;
14 /** Called when the activity is first created. */
15 @Override
16 public void onCreate(Bundle savedInstanceState) {
17 super.onCreate(savedInstanceState);
18 setContentView(R.layout.main);
19
20 final Button button = (Button) findViewById(R.id.search);
21 button.setOnClickListener(new View.OnClickListener() {
22 public void onClick(View v) {
23 webview.loadUrl(Set+R.id.set+Number+R.id.card+Lang);
24 }
25 });
26 }
27
28}
Gruß Alexander
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.