EditText Settext not working with Fragment

后端 未结 5 1889
花落未央
花落未央 2020-12-01 03:36

I have fragments for 3 states of a screen; Add, Edit and View. In Add, I create an entity and save it. Next time I open it in View mode and set the entity name using

5条回答
  •  甜味超标
    2020-12-01 04:13

    The EditText appears to have an issue with resetting text in onCreateView. So the solution here is to reset the text in onResume. This works.

    Also there's an issue in onActivityCreated. I reset edittext's content in onStart and it works. [credits to @savepopulation]

提交回复
热议问题