1

私はこのコードを持っています:

List<EditText> someList = new ArrayList<EditText>();

//Let's say we'd like to add 10 EditTexts
for(int i = 0; i < 10; i++){
    EditText t1 = new EditText(); //The EditText you'd like to add to the list
    t1.setText("lol"); //Give the EditText the value 'lol'
    someList.add(t1); //Add the EditText to the list
}

//Go over the list and get the values
for(EditText t : someList){
    String val = t.getText(); //Get the value for the temp EditText variable t
}

インデックス番号を使用して arraylist テキストを取得する方法を知りたいですか? お気に入り:somelist[2]

4

4 に答える 4

3

このような何かがうまくいくはずです:

int index = 2;
EditText et = someList.get(index);
Log.d(TAG, et.getText());
于 2013-10-17T13:38:55.453 に答える
2

これを試して :

EditText t = someList.get(2);
String text=t.getText().toString();
于 2013-10-17T13:38:28.717 に答える
0

これを試して

EditText text2=someList.get(2);
于 2013-10-17T13:39:17.040 に答える