Hi,
i have CustomListViews to select items, but on the next page also the option to move to another item.
Now, i want to update this single item. I use this function to find and update:
That works fine as long as the item is in the visible area (but in the background). When the item is outside the view i got the error
I understand the error, but i have no idea how to fix it (without loading all items again)?
Regards
Matthias
EDIT: I measured the time i need to fill all elements again. It is practically invisible - so i update the whole list... But if anyone has a good idea it would be great
i have CustomListViews to select items, but on the next page also the option to move to another item.
Now, i want to update this single item. I use this function to find and update:
B4X:
Sub refreshSingleItemByID(searchID As String)
For searchList=0 To clv1.Size-1
Dim animalSelect As animalValue=clv1.GetValue(searchList)
If animalSelect.animalID=searchID Then
clv1.JumpToItem(searchList)
clv1.Refresh
Dim dbFarms As ResultSet = database.getanimal(searchID)
Do While dbFarms.NextRow
Dim fi As animalValue
fi.animalname =dbFarms.GetString("na")
fi.barnid =dbFarms.GetString("bi")
fi.dayofbirth =dbFarms.GetString("db")
fi.dayofcalv =dbFarms.GetString("cd")
fi.animalid=dbFarms.getString("id")
fi.pedigree=database.pedigree(dbFarms)
fi.breed=dbFarms.getString("bc")
fi.group=dbFarms.GetString("gr")
fi.evalStatus=general.evaluationStatus(dbFarms)
Dim p As B4XView=clv1.Getpanel(searchList)
p.GetView(0).Text=fi.barnID '< here is the error...
p.GetView(1).Text=fi.animalName
p.GetView(2).Text=fi.dayofbirth
p.GetView(3).Text= fi.dayofcalv
p.GetView(5).Text=fi.pedigree
p.GetView(6).Text=fi.breed
p.GetView(7).Text=fi.group
p.GetView(0).TextColor=fi.evalStatus.Color
Loop
End If
Next
End Sub
That works fine as long as the item is in the visible area (but in the background). When the item is outside the view i got the error
B4X:
Error occurred on line: 214 (animallist)
java.lang.RuntimeException: Object should first be initialized (View).
Did you forget to call Activity.LoadLayout?
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4a.objects.B4XViewWrapper.GetView(B4XViewWrapper.java:318)
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.debug.Debug.delegate(Debug.java:262)
at sx.datacollector.animallist._refreshsingleitembyid(animallist.java:559)
at sx.datacollector.evaluateanimal._btnstore_click(evaluateanimal.java:1096)
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 anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
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)
I understand the error, but i have no idea how to fix it (without loading all items again)?
Regards
Matthias
EDIT: I measured the time i need to fill all elements again. It is practically invisible - so i update the whole list... But if anyone has a good idea it would be great
Last edited: