I have installed several iconbuttons on my activity.
Each one is directed to the same "click" event. I need to determine which one was clicked. I set a Tag value that tells me which one it was, but...
When the click event fires, I do this:
It abends and logs:
I don't understand the error. Is the iconbutton not a view?
any help will be appreciated.
Rusty
Each one is directed to the same "click" event. I need to determine which one was clicked. I set a Tag value that tells me which one it was, but...
When the click event fires, I do this:
B4X:
Sub icbCategory_Click
Try
Dim ThisIconButton As IconButton
ThisIconButton = Sender
Dim tg As string
tg = ThisIconButton.tag
log("thisiconbutton " & thisiconbutton.tag)
Catch
Log("icbCategory_Click error " & LastException.Message)
End Try
End Sub
It abends and logs:
Error occurred on line: 2767 (Main)
java.lang.ClassCastException: anywheresoftware.b4a.ShellBA cannot be cast to android.view.View
at anywheresoftware.b4a.objects.ViewWrapper.getTag(ViewWrapper.java:232)
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:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at de.donmanfred.IconButtonWrapper$1.onClick(IconButtonWrapper.java:73)
at android.view.View.performClick(View.java:4487)
at android.view.View$PerformClick.run(View.java:18746)
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:5257)
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:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
at dalvik.system.NativeStart.main(Native Method)
I don't understand the error. Is the iconbutton not a view?
any help will be appreciated.
Rusty