Iterate through ListView and get EditText-Field values

后端 未结 4 1090
借酒劲吻你
借酒劲吻你 2020-12-03 04:37

I\'ve created a ListView (myList) with one EditText-Field in each row (R.id.mannschaften). Under the ListView, I\'ve created a Button and set an OnClickListener for it in th

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 05:21

    Solved the Problem with the help of a friend:

    private void ButtonClick() {
        /** get all values of the EditText-Fields */
        View v;
        ArrayList mannschaftsnamen = new ArrayList();
        EditText et;
        for (int i = 0; i < myList.getCount(); i++) {
            v = myList.getAdapter().getView(i, null, null);
            et = (EditText) v.findViewById(i);
            mannschaftsnamen.add(et.getText().toString());
        }
    ....
    }
    

提交回复
热议问题