R RichardN Well-Known Member Licensed User Longtime User May 12, 2022 #1 I have a single activity app with four EditText fields. To enhance the user experience the content of each view (and cursor position) must be preserved every time the app goes to the background or terminates. Easy enough I thought.... use KVS to save and reload the fields every time the app Resumes or Pauses. This method does most of the job as when the app is simply sent to the background it can be recalled by the user and sure enough the focus remains with the last used EditText. Unfortunately as I have re-populated the EditText.Text from KVS in the Resume Event it is repopulated correctly but the cursor is repositioned to the beginning of the field instead of where the user left it. What is the smartest method of restoring each of the four EditText fields exactly as the user left them in terms of content and focus whilst catering for the Create/Resume/Pause/OS terminate lifecycle?
I have a single activity app with four EditText fields. To enhance the user experience the content of each view (and cursor position) must be preserved every time the app goes to the background or terminates. Easy enough I thought.... use KVS to save and reload the fields every time the app Resumes or Pauses. This method does most of the job as when the app is simply sent to the background it can be recalled by the user and sure enough the focus remains with the last used EditText. Unfortunately as I have re-populated the EditText.Text from KVS in the Resume Event it is repopulated correctly but the cursor is repositioned to the beginning of the field instead of where the user left it. What is the smartest method of restoring each of the four EditText fields exactly as the user left them in terms of content and focus whilst catering for the Create/Resume/Pause/OS terminate lifecycle?
teddybear Well-Known Member Licensed User May 13, 2022 #2 RichardN said: What is the smartest method of restoring each of the four EditText fields exactly as the user left them in terms of content and focus whilst catering for the Create/Resume/Pause/OS terminate lifecycle? Click to expand... You can bind the same foucs event (EditText_FocusChanged) to the four EditText fields, and then put the current foucs item into kVS Upvote 0
RichardN said: What is the smartest method of restoring each of the four EditText fields exactly as the user left them in terms of content and focus whilst catering for the Create/Resume/Pause/OS terminate lifecycle? Click to expand... You can bind the same foucs event (EditText_FocusChanged) to the four EditText fields, and then put the current foucs item into kVS
Erel B4X founder Staff member Licensed User Longtime User May 13, 2022 #3 First step is to switch to B4XPages. It will solve 95% of the cases. Upvote 0