Android Question MaskedEditText view focus not going where expected


Well-Known Member
Licensed User
Longtime User
Hi Everyone,

I'm using the masked MaskedEditText view and have sever of those views on a panel. Some of them are laid out like this:

Address1                   Address2

City                          State             Zip

I'm trying to force focus onto a particular MaskedEditText view when the user taps the "Next" button from the soft keyboard.

I used this coding to make sure there is a "Next" button showing up in the soft keyboard by setting SingleLine to True:

    edtAddress1.SingleLine = True
    edtAddress1.Typeface = Typeface.DEFAULT_BOLD

    edtAddress2.SingleLine = True
    edtAddress2.Typeface = Typeface.DEFAULT_BOLD
    edtCity.SingleLine = True
    edtCity.Typeface = Typeface.DEFAULT_BOLD
    edtState.SingleLine = True
    edtState.Typeface = Typeface.DEFAULT_BOLD

    edtZip.SingleLine = True
    edtZip.Typeface = Typeface.DEFAULT_BOLD

    edtParentsEmail.SingleLine = True
    edtParentsEmail.Typeface = Typeface.DEFAULT_BOLD

    edtPrimaryPhone.SingleLine = True
    edtPrimaryPhone.Typeface = Typeface.DEFAULT_BOLD

    edtSecondaryPhone.SingleLine = True
    edtSecondaryPhone.Typeface = Typeface.DEFAULT_BOLD

When pressing the "Next" button from the keyboard, focus goes from "Address1" over to "State" when it should be going over to "Address2". I added this coding which I thought would force the focus onto "Address2":

Sub edtAddress1_FocusChanged(HasFocus As Boolean)
    If HasFocus = False Then
    End If
End Sub

Instead of the focus going over to "Address2", I noticed 2 sets of cursor flashing. One flashing cursor was in "Address1" and another flashing cursor was in "Address2". When I typed into the keyboard, focus was still on "Address1" because the characters were being entered into "Address1" even though both views had flashing cursors in them.

Is there a way to get focus onto "Address2" with this scenario?

I also noticed then both cursors are flashing, I can tap other MaskedEditText views and the 2nd flashing cursor still flashes in "Address2" and if I tab "Address2" and try to enter text, focus does not move away from any other MaskedEditText view. It's like "Address2" becomes disabled somehow unless I exit from the screen with those views and go back on that screen.

Last edited: