Hi,
In this POST
https://www.b4x.com/android/forum/t...w-to-get-view-index-values.69907/#post-452411
I comment that I have a Layout with panels, Labels, Imageview and one ACSwich
Erel and DonManfred give me some possible solutions, but I can't solve this issue.
In my CreateListItem I add some new parameters and my code is that
The Item is displayed correctly
The problem is when I want to change the ACSwitch state, turn OFF or ON
I receive this error
This is the line with error
I has changed the parameter, from 0 to 10 and allways have error.
This is my Tree View (see attached file)
I'm hold in this problem
Thanks
In this POST
https://www.b4x.com/android/forum/t...w-to-get-view-index-values.69907/#post-452411
I comment that I have a Layout with panels, Labels, Imageview and one ACSwich
Erel and DonManfred give me some possible solutions, but I can't solve this issue.
In my CreateListItem I add some new parameters and my code is that
B4X:
Sub CreateListItem(Hora As String, Dias As String, NombreAlarma As String, Activa As Boolean, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
Activity.AddView(p, 0, 0, Width, Height)
p.LoadLayout("ItemAlarma")
p.RemoveView
lblHora.Text=Hora
lblDias.Text=Dias
lblNombre.Text=NombreAlarma
OnOff.Checked=Activa
lblHora.Enabled=Activa
lblDias.Enabled=Activa
lblNombre.Enabled=Activa
If Activa Then
IconoON.Visible=True
IconoOFF.Visible=False
Else
IconoON.Visible=False
IconoOFF.Visible=True
End If
Return p
End Sub
The Item is displayed correctly
The problem is when I want to change the ACSwitch state, turn OFF or ON
B4X:
Sub OnOff_CheckedChange(Checked As Boolean)
If CargaInicial Then Return
Dim index As Int= ClvAlarmas.GetItemFromView(Sender)
Dim pnl As Panel
pnl = ClvAlarmas.GetPanel(index)
Dim chk As ACSwitch
chk = pnl.GetView(5)
Msgbox($"Item value: ${ClvAlarmas.GetValue(index)}
Check value: ${chk.Checked}"$, "")
End Sub
I receive this error
B4X:
Error occurred on line: 132 (Main)
Message longer than Log limit (4000). Message was truncated.
java.lang.RuntimeException: Object should first be initialized (View).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
at anywheresoftware.b4a.objects.CompoundButtonWrapper$1.onCheckedChanged(CompoundButtonWrapper.java:44)
at android.widget.CompoundButton.setChecked(CompoundButton.java:154)
at android.support.v7.widget.SwitchCompat.setChecked(SwitchCompat.java:1066)
at android.support.v7.widget.SwitchCompat.stopDrag(SwitchCompat.java:1007)
at android.support.v7.widget.SwitchCompat.onTouchEvent(SwitchCompat.java:957)
at android.view.View.dispatchTouchEvent(View.java:8505)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2408)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2107)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2390)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1734)
at android.app.Activity.dispatchTouchEvent(Activity.java:2833)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:63)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:63)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2351)
at android.view.View.dispatchPointerEvent(View.java:8700)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4415)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4281)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3779)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3832)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3798)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3915)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3806)
at android.v
This is the line with error
chk = pnl.GetView(5)
I has changed the parameter, from 0 to 10 and allways have error.
This is my Tree View (see attached file)
I'm hold in this problem
Thanks