Getting values from RecyclerView EditText?

前端 未结 5 1623
清酒与你
清酒与你 2021-01-05 12:51

I am struck in recyclerView,

\"image\"

Here the name and balance fields are coming from two different a

5条回答
  •  梦谈多话
    2021-01-05 13:19

    A better approach to performance

    private List getQuantityList() {
        List quantities = new ArrayList<>();
    
        for (int i = 0; i < cartItems_rv.getChildCount(); i++) {
            quantities.add(Integer.valueOf(((EditText)Objects.requireNonNull(
                    Objects.requireNonNull(cartItems_rv.getLayoutManager()).findViewByPosition(i))
                    .findViewById(R.id.quantity_et)).getText().toString()));
        }
    
        return quantities;
    }
    

    thanks for Goku's answers, feel free to shape the method for your own app.

提交回复
热议问题