Android Question Keyboard not showing --- Solved

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All,

The soft keyboard is refusing to show itself in my project.
I have lifted the subs below from another project where I have no problem.
The Sub ExFileNameSet simply brings to the front a couple of buttons and the keyboard for the entry of a file name. Buttons come forward, no keyboard....?

B4X:
Sub ExFileNameSet
'Brings up the keyboard to allow a File Name to be entered.
'Called by Export_click
    FMask.BringToFront                                        'Button defined in designer Dimmed in Sub Globals
    BtnExFile.BringToFront                                  'Button defined in designer Dimmed in Sub Globals
    Rdisplay.Text = ""
    kb.ShowKeyboard(Rdisplay)        ' kb Dimmed as IME in Sub Globals,Initialized in Activity_Create(FirstTime As Boolean)
    kb.SetCustomFilter(Rdisplay, Rdisplay.INPUT_TYPE_TEXT, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
    RFocus = 1                                                'Variable used by Sub Activity_KeyPress
End Sub

Sub BtnExFile_click
'Completes/Saves the entry of a File name to be applied to the Exported file.  Shown as "Enter" on screen.
'Returns Filename1 to Export_click
    Dim FileOption As Int
'    Idisplay.Text = ""
    ExFileName_flag = 0
   
    If Rdisplay.Text <> "" Then
        Filename1 = Rdisplay.Text
        Filename1 = Filename1&".txt"
        ExFileName_flag = 1
' Get list of existing files to FileListing1 and check if Filename1 already exists
        FileListing1.Clear
        FileListing1 = FileLists.ListFiles(File.DirRootExternal & "/Download/", "*.txt", True, True)
        For i = 0 To FileListing1.Size-1
             If Filename1 = FileListing1.Get(i) Then
                FileOption = Msgbox2("Overwrite "&Filename1&"?","Existing File","Yes","","No",Null)
                If FileOption = DialogResponse.NEGATIVE Then ExFileName_flag = 0
                Exit
            End If
        Next
    End If
   
    Rdisplay.InputType = Rdisplay.INPUT_TYPE_NONE
    Rdisplay.InputType = Bit.Or(Rdisplay.InputType, 0x00000080)            'Prevents spellchecker underlining words   
    kb.HideKeyboard
    RFocus = 0
    Rdisplay.Text = 0
    dummytext.RequestFocus
    FMask.SendToBack
    BtnExFile.SendToBack
    ListFlag = 0
    LanguagExport_click
End Sub

Any suggestions greatfully received.

Regards Roger
 

ArminKH

Well-Known Member
Hi All,

The soft keyboard is refusing to show itself in my project.
I have lifted the subs below from another project where I have no problem.
The Sub ExFileNameSet simply brings to the front a couple of buttons and the keyboard for the entry of a file name. Buttons come forward, no keyboard....?

B4X:
Sub ExFileNameSet
'Brings up the keyboard to allow a File Name to be entered.
'Called by Export_click
    FMask.BringToFront                                        'Button defined in designer Dimmed in Sub Globals
    BtnExFile.BringToFront                                  'Button defined in designer Dimmed in Sub Globals
    Rdisplay.Text = ""
    kb.ShowKeyboard(Rdisplay)        ' kb Dimmed as IME in Sub Globals,Initialized in Activity_Create(FirstTime As Boolean)
    kb.SetCustomFilter(Rdisplay, Rdisplay.INPUT_TYPE_TEXT, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
    RFocus = 1                                                'Variable used by Sub Activity_KeyPress
End Sub

Sub BtnExFile_click
'Completes/Saves the entry of a File name to be applied to the Exported file.  Shown as "Enter" on screen.
'Returns Filename1 to Export_click
    Dim FileOption As Int
'    Idisplay.Text = ""
    ExFileName_flag = 0
  
    If Rdisplay.Text <> "" Then
        Filename1 = Rdisplay.Text
        Filename1 = Filename1&".txt"
        ExFileName_flag = 1
' Get list of existing files to FileListing1 and check if Filename1 already exists
        FileListing1.Clear
        FileListing1 = FileLists.ListFiles(File.DirRootExternal & "/Download/", "*.txt", True, True)
        For i = 0 To FileListing1.Size-1
             If Filename1 = FileListing1.Get(i) Then
                FileOption = Msgbox2("Overwrite "&Filename1&"?","Existing File","Yes","","No",Null)
                If FileOption = DialogResponse.NEGATIVE Then ExFileName_flag = 0
                Exit
            End If
        Next
    End If
  
    Rdisplay.InputType = Rdisplay.INPUT_TYPE_NONE
    Rdisplay.InputType = Bit.Or(Rdisplay.InputType, 0x00000080)            'Prevents spellchecker underlining words  
    kb.HideKeyboard
    RFocus = 0
    Rdisplay.Text = 0
    dummytext.RequestFocus
    FMask.SendToBack
    BtnExFile.SendToBack
    ListFlag = 0
    LanguagExport_click
End Sub

Any suggestions greatfully received.

Regards Roger

i did't test yet but this code works 99%
B4X:
Sub ExFileNameSet
'Brings up the keyboard to allow a File Name to be entered.
'Called by Export_click
    FMask.BringToFront                                        'Button defined in designer Dimmed in Sub Globals
    BtnExFile.BringToFront                                  'Button defined in designer Dimmed in Sub Globals
    Rdisplay.Text = ""
    CallSubDelayed(Me,"ShowKeyboard")
    RFocus = 1                                                'Variable used by Sub Activity_KeyPress
End Sub

Sub BtnExFile_click
'Completes/Saves the entry of a File name to be applied to the Exported file.  Shown as "Enter" on screen.
'Returns Filename1 to Export_click
    Dim FileOption As Int
'    Idisplay.Text = ""
    ExFileName_flag = 0
  
    If Rdisplay.Text <> "" Then
        Filename1 = Rdisplay.Text
        Filename1 = Filename1&".txt"
        ExFileName_flag = 1
' Get list of existing files to FileListing1 and check if Filename1 already exists
        FileListing1.Clear
        FileListing1 = FileLists.ListFiles(File.DirRootExternal & "/Download/", "*.txt", True, True)
        For i = 0 To FileListing1.Size-1
             If Filename1 = FileListing1.Get(i) Then
                FileOption = Msgbox2("Overwrite "&Filename1&"?","Existing File","Yes","","No",Null)
                If FileOption = DialogResponse.NEGATIVE Then ExFileName_flag = 0
                Exit
            End If
        Next
    End If
  
    Rdisplay.InputType = Rdisplay.INPUT_TYPE_NONE
    Rdisplay.InputType = Bit.Or(Rdisplay.InputType, 0x00000080)            'Prevents spellchecker underlining words  
    kb.HideKeyboard
    RFocus = 0
    Rdisplay.Text = 0
    dummytext.RequestFocus
    FMask.SendToBack
    BtnExFile.SendToBack
    ListFlag = 0
    LanguagExport_click
End Sub

Sub ShowKeyboard
    kb.ShowKeyboard(Rdisplay)        ' kb Dimmed as IME in Sub Globals,Initialized in Activity_Create(FirstTime As Boolean)
    kb.SetCustomFilter(Rdisplay, Rdisplay.INPUT_TYPE_TEXT, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
End Sub
 
Upvote 0

ArminKH

Well-Known Member
:D ok then u should attache a small project to reproduce your problem
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
i did't test yet but this code works 99%
B4X:
Sub ExFileNameSet
'Brings up the keyboard to allow a File Name to be entered.
'Called by Export_click
    FMask.BringToFront                                        'Button defined in designer Dimmed in Sub Globals
    BtnExFile.BringToFront                                  'Button defined in designer Dimmed in Sub Globals
    Rdisplay.Text = ""
    CallSubDelayed(Me,"ShowKeyboard")
    RFocus = 1                                                'Variable used by Sub Activity_KeyPress
End Sub

Sub BtnExFile_click
'Completes/Saves the entry of a File name to be applied to the Exported file.  Shown as "Enter" on screen.
'Returns Filename1 to Export_click
    Dim FileOption As Int
'    Idisplay.Text = ""
    ExFileName_flag = 0
 
    If Rdisplay.Text <> "" Then
        Filename1 = Rdisplay.Text
        Filename1 = Filename1&".txt"
        ExFileName_flag = 1
' Get list of existing files to FileListing1 and check if Filename1 already exists
        FileListing1.Clear
        FileListing1 = FileLists.ListFiles(File.DirRootExternal & "/Download/", "*.txt", True, True)
        For i = 0 To FileListing1.Size-1
             If Filename1 = FileListing1.Get(i) Then
                FileOption = Msgbox2("Overwrite "&Filename1&"?","Existing File","Yes","","No",Null)
                If FileOption = DialogResponse.NEGATIVE Then ExFileName_flag = 0
                Exit
            End If
        Next
    End If
 
    Rdisplay.InputType = Rdisplay.INPUT_TYPE_NONE
    Rdisplay.InputType = Bit.Or(Rdisplay.InputType, 0x00000080)            'Prevents spellchecker underlining words 
    kb.HideKeyboard
    RFocus = 0
    Rdisplay.Text = 0
    dummytext.RequestFocus
    FMask.SendToBack
    BtnExFile.SendToBack
    ListFlag = 0
    LanguagExport_click
End Sub

Sub ShowKeyboard
    kb.ShowKeyboard(Rdisplay)        ' kb Dimmed as IME in Sub Globals,Initialized in Activity_Create(FirstTime As Boolean)
    kb.SetCustomFilter(Rdisplay, Rdisplay.INPUT_TYPE_TEXT, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
End Sub

ArminKH,

I have had a similar problem in a different area of code and went back to your suggestion here. It worked perfectly.
Thanks for the help.

Regards Roger
 
Upvote 0
Top