U unba1300 Guest Jan 19, 2012 #1 Hello, I am using code like the following to add to a list what text is in each of ten edittexts when the activity gets paused: Code: Copy Dim et As EditText For i = 9 To 0 Step -1 et = sv1.Panel.GetView(i) lst1.Add(et.text) Next But could someone please tell me how to determine in this loop which edittext the user is using at the time (so that I can set the cursor back there during Resume). Thanks.
Hello, I am using code like the following to add to a list what text is in each of ten edittexts when the activity gets paused: Code: Copy Dim et As EditText For i = 9 To 0 Step -1 et = sv1.Panel.GetView(i) lst1.Add(et.text) Next But could someone please tell me how to determine in this loop which edittext the user is using at the time (so that I can set the cursor back there during Resume). Thanks.
Ricky D Well-Known Member Licensed User Longtime User Jan 19, 2012 #2 Maybe try this On each textview why don't you capture the viewname Code: Copy Sub Process_Globals Dim ViewName as string End Sub . . . Sub aView_FocusChanged (HasFocus As Boolean) If HasFocus=True Then ViewName = "aView" End Sub where aView is the textview. When the activity gets restarted look for which one (if any) had focus Code: Copy Sub Activity_Resume Select ViewName Case "aView" aView.RequestFocus . . other views End Select There may be other ways to do it but I can only see this one. I can be a little shortsighted at times lol. Upvote 0
Maybe try this On each textview why don't you capture the viewname Code: Copy Sub Process_Globals Dim ViewName as string End Sub . . . Sub aView_FocusChanged (HasFocus As Boolean) If HasFocus=True Then ViewName = "aView" End Sub where aView is the textview. When the activity gets restarted look for which one (if any) had focus Code: Copy Sub Activity_Resume Select ViewName Case "aView" aView.RequestFocus . . other views End Select There may be other ways to do it but I can only see this one. I can be a little shortsighted at times lol.