Guten Tag
Ich habe da ein kleines Problem:
Ich habe diese Methode geschrieben um den Text in den einzelnen EditTexts zu ändern, nru mein Problem ist, dass ich sehr viele EditTexte habe nun möchte ich aber nicht immer schreiben
EditText Feld = (EditText)findViewById(R.id.Reihe1)
sondern dass etwas in der art:
EditText Feld = (EditText)findViewById(R.id.Reihe);
Hat da jmd vielleicht eine gute Idee ?
[XML] <EditText
android:id="@+id/Reihe2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<EditText
android:id="@+id/Reihe3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<EditText
android:id="@+id/Reihe4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<EditText
android:id="@+id/Reihe5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
...........
[/XML]
Ich habe da ein kleines Problem:
Ich habe diese Methode geschrieben um den Text in den einzelnen EditTexts zu ändern, nru mein Problem ist, dass ich sehr viele EditTexte habe nun möchte ich aber nicht immer schreiben
EditText Feld = (EditText)findViewById(R.id.Reihe1)
sondern dass etwas in der art:
EditText Feld = (EditText)findViewById(R.id.Reihe);
Hat da jmd vielleicht eine gute Idee ?
Java:
public void infosLaden(){
Send.laden();
zahl=Send.getZahl();
for(int i=0;i<zahl;i++){
Text=Send.getText();
EditText Feld = (EditText)findViewById(R.id.Reihe1);
Feld.setText(Text);
}
}
android:id="@+id/Reihe2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<EditText
android:id="@+id/Reihe3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<EditText
android:id="@+id/Reihe4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<EditText
android:id="@+id/Reihe5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
...........
[/XML]
Zuletzt bearbeitet: