O
O
Oleg Carp2020-09-28 17:09:43
Java
Oleg Carp, 2020-09-28 17:09:43

How to save EditText -> RecyclerView value to file?

The bottom line is that there is an activity Structure in it RecyclerView; RV contains a CardView "tier"
tier also contains a RecyclerView and it contains a set number of other CardViews with EditText cells.
And after calling the onPause() method in the activity, they should be saved to a binary file.

5f71e85e947e7273221308.jpeg

It is necessary somehow to inform each object where to take the data. Taking into account that there will be many such tiers and elements with cells are also changeable
Something like this
object1.setCoef(coef.getText().toString());

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Carp, 2020-09-28
@Rebel-Cat

So far implemented through TextWatcher

onBindViewHolder(ProductViewHolder holder, int position) {
...
holder.textCoef.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
             //Действия при изменении поля EditText   
            }
        });
}

True, there is too much code, with so many EditText

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question