Android Question SD_CustomKeyboard

Pesciolina

Active Member
Licensed User
Longtime User
I found how to disable the keyboard for each EditText object, but now I need to enable the custom keyboard for each edittext, how can I do it?

Thank you
 
Upvote 0

Pesciolina

Active Member
Licensed User
Longtime User
I use this routine to create EditText, how can I enable the SD_CustomKeyboar keyboard?

B4X:
Private Sub AggiungiNumeroAllaRiga(numero As String, progressivo As Int)
    ' Crea una nuova etichetta per visualizzare il numero e il numero progressivo  
   
     
    Dim lblNumero As B4XView = CreateLabel("")  
    DisableSoftKeyboard(lblNumero)
   
       
    ' Visualizza il numero principale e il progressivo in piccolo sotto
    lblNumero.Text = numero & CRLF & "[#" & progressivo & "]"
    lblNumero.Tag = numero & "-" & progressivo ' Salva il numero e il progressivo come Tag
    lblNumero.TextSize = 22
    lblNumero.SetTextAlignment("TOP" , "CENTER")
    lblNumero.Color = xui.Color_LightGray
    lblNumero.SetLayoutAnimated(0,  currentCount * (100%x / maxNumeriPerRiga) ,  0, 100%x / maxNumeriPerRiga, 70dip  )
   
    currentRow.AddView(lblNumero,currentCount * (100%x / maxNumeriPerRiga), 0,100dip,100dip)  
    currentCount = currentCount + 1
   
    ' Se la riga ha raggiunto il numero massimo di numeri, aggiungi una nuova riga
    If currentCount = maxNumeriPerRiga Then
        AggiungiNuovaRiga
    End If
End Sub

Sub CreateLabel (Text As String) As B4XView
    Dim l As EditText
    l.Initialize("") 'assuming that events not needed
    l.Text = Text
    Return l
End Sub
 
Upvote 0

Pesciolina

Active Member
Licensed User
Longtime User
I solved the problem with this command

B4X:
SD_Keyboard1.SetKeyboard(lblNumero, "lblNumero"  ,Ck, False, Null)

Now when I press enter on the B4xView I get this error
B4X:
java.lang.ClassCastException: b4a.example.sd_keyboard cannot be cast to android.view.View
    at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(B4XViewWrapper.java:91)
    at anywheresoftware.b4a.objects.B4XViewWrapper.getTag(B4XViewWrapper.java:600)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.BA$2.run(BA.java:395)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7937)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019)


B4X:
Sub lblNumero_EnterPressed
    Dim edtView As B4XView = Sender
    Dim Progr As Int = edtView.Tag
    Log(Progr)
End Sub

Is there a way to solve this or should I switch to the default keyboard?
 
Upvote 0
Top