Android Question [B4A] Change InputType of Input dialogs with XUI Views

ziovec

Member
Licensed User
I searched through the forum, but I couldn't find a solution :(
I'm using input dialog with XUI in order to grab input data from the user.
I would like to set the input type (eg: a phone number) so that the keyboard only shows number keys.
Same for email input (they're similar to common text input, but there's the @ next to the space bar).

I know how to do it using a simple InputDialog (from Dialog lib), but I can't see the way to do it with XUI!


B4X:
    Dim input As B4XInputTemplate
    input.Initialize
    input.lblTitle.Text = "Numero di telefono:"
    input.Text = kvs.Get("Tel")
    Wait For (dialog.ShowTemplate(input, "OK", "", "ANNULLA")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Dim res As String = input.Text
        kvs.Put("Tel",res)
        lblTel.Text = kvs.Get("Tel")
    End If
 
Last edited:

Mahares

Expert
Licensed User
Longtime User
I searched trhough the forum, but I couldn't find a solution :(
Something like this:
B4X:
Dim input As B4XInputTemplate
    input.Initialize
    input.lblTitle.Text = "Numero di telefono:"
    Dim et1 As EditText= input.TextField1  'expose native view
    et1.InputType = et1.INPUT_TYPE_PHONE
    input.Text = kvs.Get("Tel")
    Wait For (Dialog.ShowTemplate(input, "OK", "", "ANNULLA")) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        Dim res As String = input.Text
        kvs.Put("Tel",res)
        lblTel.Text = kvs.Get("Tel")
        Log(res)
    End If
 
Upvote 0

ziovec

Member
Licensed User
Something like this:
B4X:
Dim input As B4XInputTemplate
    input.Initialize
    input.lblTitle.Text = "Numero di telefono:"
    Dim et1 As EditText= input.TextField1  'expose native view
    et1.InputType = et1.INPUT_TYPE_PHONE
    input.Text = kvs.Get("Tel")
    Wait For (Dialog.ShowTemplate(input, "OK", "", "ANNULLA")) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        Dim res As String = input.Text
        kvs.Put("Tel",res)
        lblTel.Text = kvs.Get("Tel")
        Log(res)
    End If
Thanks a lot! You saved my life šŸ˜
 
Upvote 0
Top