Android Question Scrollview load more on reaching end of panel

Fusseldieb

Active Member
Licensed User
Longtime User
Hi community,
it is possible to "calculate", if the user is reaching the inner limit of the ScrollView, in order to load more entries?
If yes, have somebody a example code please?

Thanks in advance ;)
 

Fusseldieb

Active Member
Licensed User
Longtime User
You can test in the ScrollChanged event if the Position is equal to ScrollView1.Panel.Height - ScrollView1.Height or bit lower.
Klaus, ahaaa, ei schwiizer :p

Returning on topic.... You have helped me very much. I have resolved it with:
B4X:
Sub ScrollView1_ScrollChanged(Position As Int)
If Position > (ScrollView1.Panel.Height - ScrollView1.Height)-20dip Then
'Run "load more" event
End If
End Sub
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
The items are added to the list. No item is being reloaded.
Sorry Erel, went thru the code again it is only adding new panels.In my case i need to add panels above the previous panel.Is there any efficient way of doing this i ended up doing like this.
On Activity_Create
1. Add n panels one after other
2. Set a boolean value to false
In a transparent pnl touch event
1. Set the boolean to true (I added this panel for other purpose, so used it)
In ScrollChanged
1. Check for boolean if true
2. Check for value "position"
2. Add next lot of n items
3. Sort them on ID (clsCheckList)
4. Set boolean value to false
When i scroll up it loads items n at a time there is slight delay bearable. Is there any more efficient way you can suggest please.

Thanks
Juzer
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Yes I saw it earlier Erel but I found sorting much easier here, After adding one lot at end (20 panels) it sorts whole SV in one shot and as sendtoback and bringtofront properties are used it does it instantly.
Thank You
Juzer
 
Upvote 0
Top