Android Question CLVSwipe - How to get the value of button.tag from buttons on other pages

NLok

Member
If the list item of my CustomView(clvList) is selected through the button.tag value in the CustomView (clvItem) of other pages. So how do I get the original button.tag value instead of the sequential value(index) in Sub swipe_ActionClicked in CustomView (clvList).

Because when you choose to press the first item option of CustomView (clvList), its index will show 0. How to get the original value of button.tag in the first item option of CustomView (clvList) (for example, its original value is A03)

B4X:
Sub Swipe_ActionClicked (Index As Int, ActionText As String)
    Log($"Action clicked: ${Index}, ${ActionText}"$)

    If ActionText = "Delete" Then
          CustomListView1.RemoveAt(Index)
    End If
End Sub
 
Last edited:

NLok

Member
You can put whatever you like in the Value parameter (CreateItemValue) and later get it with:
B4X:
Dim si As SwipeItem = CustomListView1.GetValue(index)
Dim value As AnythingYouLike = si.Value

Hello Erel, if the original Data type of CustomListView1.GetValue(index) is GetValue (Index As Int) As Object. So can I write Dim Index As String on it ?

If it can be changed, I have replaced it with string, but there is still an error

Error occurred on line: 146 (Menu)
java.lang.NumberFormatException: For input string: "A01"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at anywheresoftware.b4a.debug.RDebugUtils.numberCast(RDebugUtils.java:58)
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:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at b4a.example.menu._refreshgrid(menu.java:483)
at b4a.example.menu._activity_create(menu.java:409)
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:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.example.menu.afterFirstLayout(menu.java:105)
at b4a.example.menu.access$000(menu.java:17)
at b4a.example.menu$WaitForLayout.run(menu.java:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
 
Upvote 0
Top