N
N
Neonoviiwolf2017-03-13 18:56:01
Android
Neonoviiwolf, 2017-03-13 18:56:01

When the screen is rotated, all EditTexts get the same text, how to fix?

Good
There is a fragment - fr1, I inflate it with the same fragments fr2. Each fr2 has an EditText, I enter some text into these EditText. I rotate the screen and all EditText get the text that was entered in the last added fr2. How to fix it?
Here is an excerpt from fr1

@Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_create_menu, container, false);

        LinearLayout layout = (LinearLayout) view.findViewById(R.id.testLin);
        View viewDateMenu = dateMenu.onCreateView(inflater, layout, new Bundle());
        layout.addView(viewDateMenu);

Here is fr2 and EditText
private EditText editText;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.item_menu, container, false);

        editText = (EditText) view.findViewById(R.id.edit_text_name_product);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question