[Beginnerfrage] Umsetzungsproblem mit Eingabefenstern

  • 1 Antworten
  • Letztes Antwortdatum
M

mentismora

Neues Mitglied
0
Also ich habe eigentlich schnell immer nen Plan wenn es um Programmieren von Sachen geht, gerade mit Eclipse aber diese Android Umgebung macht mich ein wenig durcheinander ^^ Ich habe nun folgendes Problem:

Code:
<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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".Main_act" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="@string/welcome" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="60dp"
        android:ems="10"
        android:inputType="number"
        android:text="0" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/editText1"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="39dp"
        android:text="@string/liter" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/editText1"
        android:layout_below="@+id/editText1"
        android:layout_marginTop="20dp"
        android:text="@string/euro" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView3"
        android:layout_below="@+id/textView3"
        android:ems="10"
        android:inputType="number"
        android:text="0" >

        <requestFocus />
    </EditText>

</RelativeLayout>

Hier möchte ich nun das er Liter und Euro eingabe speichert in einer variable und dann dieses dann anfängt zu teilen also liter:euro und dadurch dann den Kurs für den Liter erechnet. Kann mit einer sagen wo zur hölle ich die vari´s anlege und wo ich die berechnung anlege und wie ? Ich bin total durcheinander in diesem gewusel von Dateien die schon vorangelegt sind :S
 
In deiner Activity zB in onCreate:

EditText editText1 = (EditText) findViewById(R.id.editText1);

dann kannst du dir zB den Text mit editText1.getText() auslesen.

Siehe auch: EditText | Android Developers
 
Zurück
Oben Unten