Android Question DSFloatLabelEditText - android.support.v7.widget.AppCompatEditText cannot be cast

dragonguy

Active Member
Licensed User
Longtime User
I set all the DSFloatLabelEditText event name to 'edt'
B4X:
Private edt_note1 As DSFloatLabelEditText
Private edt_note2 As DSFloatLabelEditText
Private edt_note3 As DSFloatLabelEditText

B4X:
Sub edt_FocusChanged (HasFocus As Boolean)
       Dim veiw as DSFloatLabelEditText = Sender '<= this line get error
       log(view.tag)
End Sub

when the DSFloatLabelEditText get the focus, i got this error code below:
B4X:
java.lang.ClassCastException: android.support.v7.widget.AppCompatEditText cannot be cast to de.amberhome.objects.FloatlabelEditTextWrapper$InnerTextInputLayout
   at com.testing.main._edt_focuschanged(main.java:3752)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:735)
   at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:357)
   at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
   at anywheresoftware.b4a.BA$1.run(BA.java:330)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:149)
   at android.app.ActivityThread.main(ActivityThread.java:5061)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
   at dalvik.system.NativeStart.main(Native Method)

anyone know how to solve the error?
 

Semen Matusovskiy

Well-Known Member
Licensed User
Instead of
B4X:
Dim view as DSFloatLabelEditText = Sender
try to use
B4X:
Dim View As View = Sender
View = View.Parent
Dim DSFloatlabelEditText As DSFloatLabelEditText = View.Parent

Then you can output DSFloatlabelEditText.Tag
 
Last edited:
Upvote 0
Top