Android Question Animation Check Box - AnimCheckBox lib

Masoud44

Member
Hi
please help and guide me
I created an scrollview and added a checkbox with AnimCheckBox lib to it. Now when I try to access its tag in the sub click through Sender, I encounter a Java error.

B4X:
Sub Chk_check_changed
    Dim chk As AnimCheckBox = Sender
    Log(chk.Tag)
End Sub
 

Masoud44

Member
thank you Erel
Sender for edit text worke correctly but for animcheckbox not

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.

'    Private chk As AnimCheckBox

    Dim PanelHeight As Int    : PanelHeight = 45dip

    Private ScrollView1 As ScrollView
    Private Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
   
    ScrollView1.Initialize(100)
   
    Activity.AddView(ScrollView1, 0, 50, 100%x, 100%y-300)
   

    For i = 0 To 100
        Dim Panel1 As Panel
        Dim chk As AnimCheckBox
        Dim txt As EditText
        Panel1.Initialize("")
        ScrollView1.Panel.AddView(Panel1,0,i*PanelHeight,100%x,PanelHeight)
        If (i Mod 2)=1 Then
            Panel1.Color=Colors.White
        Else
            Panel1.Color=Colors.Blue
        End If
        chk.Initialize("chk")
        Panel1.AddView(chk,100%x-32dip, 5dip, 36dip, 36dip)
        chk.Tag=i
       
        txt.Initialize("txt")
        Panel1.AddView(txt,0, 5dip, 400dip, 36dip)
        txt.Tag=i
       
    Next

    ScrollView1.Panel.Height = 100*PanelHeight

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
       
Sub Chk_check_changed
    Log("chkchange")
    Dim chk As AnimCheckBox  = Sender
    Log(chk.tag)
End Sub

Sub txt_click
    Log("txtclick")
    Dim txt As EditText = Sender
    Log(txt.Tag)
End Sub

Sub txt_TextChanged (Old As String, New As String)
    Log("textchanged")
    Dim txt As EditText = Sender
    Log(txt.Tag)
End Sub

Sub txt_FocusChanged (HasFocus As Boolean)
    Log("focuschange")
    Dim txt As EditText = Sender
    Log(txt.Tag)
End Sub


'
'B4A Version: 10.0
'Java Version: 8
'Parsing code.    (0.01s)
'Building folders structure.    (0.02s)
'Compiling code.    (0.03s)
'Compiling layouts code.    (0.00s)
'Organizing libraries.    (0.00s)
'    (AndroidX SDK)
'Generating R File.    (0.00s)
'Compiling debugger engine code.    (0.00s)
'Compiling generated Java code.    Error
'B4A line: 74
'Dim chk As AnimCheckBox = Sender
'javac 1.8.0_131
'src\chk\list\saba\main.java:505: error: cannot find symbol
'_chk = (animcheckboxwrapper.animCheckBoxWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new animcheckboxwrapper.animCheckBoxWrapper(), (main.java.com.github.lguipeng.library.animcheckbox.AnimCheckBox)(anywheresoftware.b4a.keywords.Common.Sender(mostCurrent.activityBA)));
'                                                                                                                                                            ^
'  symbol:   class java
'  location: class main
'۱ error



'Error occurred on line: 75 (Main)
'java.lang.ClassCastException: anywheresoftware.b4a.ShellBA cannot be cast To android.view.View
 
Last edited:

Masoud44

Member
B4A Version: 10.0​
Java Version: 8​
Parsing code. (0.01s)​
Building folders structure. (0.02s)​
Compiling code. (0.03s)​
Compiling layouts code. (0.00s)​
Organizing libraries. (0.00s)​
(AndroidX SDK)​
Generating R File. (0.00s)​
Compiling debugger engine code. (0.00s)​
Compiling generated Java code. Error​
B4A line: 74​
Dim chk As AnimCheckBox = Sender​
javac 1.8.0_131​
src\chk\list\saba\main.java:505: error: cannot find symbol​
_chk = (animcheckboxwrapper.animCheckBoxWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new animcheckboxwrapper.animCheckBoxWrapper(), (main.java.com.github.lguipeng.library.animcheckbox.AnimCheckBox)(anywheresoftware.b4a.keywords.Common.Sender(mostCurrent.activityBA)));​
^​
symbol: class java​
location: class main​
۱ error​
 

Masoud44

Member
thanks
Allright , i used from AnimatedCheckBox instead it
offcurse in AnimatedCheckBox we can not to change size of unchecked and me Forced used SetBackgroundImage for uncheck and it is not good way but i force
 
Top