Android Question SetOnLongClickListener runtime error ?

sanduro

Member
Licensed User
Longtime User
Hallo ,

I set onClick and onLongclick listener to my panel. On click works fine , longclick generates error in runtime. Any help please ?

thx san

B4X:
Dim R As Reflector
R.Target= pPanel
R.SetOnClickListener(pName&"_click")
R.SetOnLongClickListener(pName&"_longclick")

Here is the handling:

B4X:
Sub RPM_click(viewtag As Object)
    ToastMessageShow("RPMs", True)
End Sub

Sub RPM_longclick(viewtag As Object)
    ToastMessageShow("RPM", True)
End Sub

Click event works fine, on LongClick I get this error :

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean


at anywheresoftware.b4a.agraham.reflection.Reflection$3.onLongClick(Reflection.java:1011)
at android.view.View.performLongClick(View.java:4238)
at android.view.View$CheckForLongPress.run(View.java:17323)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
 

sanduro

Member
Licensed User
Longtime User
I can not handle the LongClick, panel are not declared in b4a , rather I read what is in designer and according the Tag, I built dynamically context and GUI of the panels by different classes.

I include zip file ....

Maybe it can be done other way, I just like the idea that all I need is to create a panel in Designer, give him a proper TAG and then just add one CASE statement and my panel is doing what i like ...

B4X:
    Case "Speed"
                    CallSub3(PANELS.Get(i), "setContext", "km/h" , "13,4")
 

Attachments

  • PFW.zip
    69.2 KB · Views: 169
Upvote 0
Top