Manually changing FocusChanged on an EditText

boastrike

Member
Licensed User
I have been reading the threads on the issues with FocusChanged on edittexts. I'm running into an issue where I have an edittext field and a listview along with a couple of buttons. The process is basically a user enters some data into the edit text field and it adds a row to the listview.

The issue doesn't appear until the user processes the data they have entered which consists of creating a CSV file and sends it on its way. The problem comes when the app calls listview.clear and it generates a call to the edittext_focuschanged for some reason. It sets the HasFocus to true and then the edittext field no longer responds to the user when you touch/tap on the field to enter new data into the text field. It seems to be stuck on true. I can touch/tap on other buttons and they respond but nothing doing with the edittext.

I was hoping I could force the HasFocus to false so it would be ready to respond but so far no luck. Any hints to resolving this would be most helpful. I'm working to create a small app that duplicates this but have not gotten it yet.

Thanks, boa
 

boastrike

Member
Licensed User
Erel,

No it doesn't as I have the edtitem set to not accept text in the Activity_Create because I display a custom keyboard if they click on the field.

B4X:
edtItem.InputType = edtItem.INPUT_TYPE_NONE

As I debug it, it is when the line lvItemList.Clear is called.

Could it have something to do with the index of the edittext and listview views? The problem doesn't start happening until after returning from the email intent.

In debug it shows that HasFocus is true already and the focuschanged event for the edtitem does get called and the boolean set during the execution of the lvItemList.Clear. I've placed requestfocus to another view to no help.

If I change the orientation of the device and back it does reset the hasfocus boolean however.

B4X:
Sub edtItem_FocusChanged (HasFocus As Boolean)
    
      If HasFocus Then
         pnlKeyboard.Visible = True
      End If
      
End Sub



Thanks, Boa
 
Upvote 0

boastrike

Member
Licensed User
Erel,

Thank you very much! Adding the event cured my issue. Kudos to your efforts and dedication to not only the product advancement but to your user community.

Thanks! :sign0188:
 
Upvote 0
Top