Scrollview advice needed

Shane119

Member
Licensed User
Longtime User
Hi Everyone

I've been playing with SQL and ScrollView. I've used Klaus's "Another ScrollView example" (CustomScrollView) as a starting pint and placed the 1st 6 items in a Table into Scroll view - including Images - (Thanks again Klaus and others for your help).

When an item is selected - a 2nd activity appears where I can edit the info and save it back to the DB - this then closes and I'm returned to my 1st Activity with the 6 items. Plus there is another opion to ADD a new record.

What I need to do now is update this Scrollview again when I return to the 1st Activity. What would be the best way to achieve this?

1) Use code on the save button to update the list (directly from 2nd Activity onto 1st Activity)
2) Use the Activity_Resume on the 1st form?

I assume I need to clear out the scrollview first, if this is the case - how do I do that.

Thank you inadvance for all help given

Shane
 

kickaha

Well-Known Member
Licensed User
Longtime User
I tend to use the "Resume" sub, as this gets called after create anyway.

So I set things up in the create sub, then fill in any data in the resume, this way it is always correct when I come back to it.

To clear a panel of views (assuming it is called Panel1):
B4X:
   For i = Panel1.NumberOfViews -1 To 0 Step -1
      Panel1.RemoveViewAt(i)
   Next
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You could also have look here: ScrollView example with multiselection and SQL
The routine to clear the ScrollView is ClearAll.

Do you really need a second Activity, you could also use a Panel in the same Activity to do it.

Best regards.
 
Upvote 0

Shane119

Member
Licensed User
Longtime User
Thanks Kickaha

Good advice I'll give it a go.

Klaus as always thank you for your advice and guidance. Yes it does need to be another activity - there is an intermediaty activity which I did not mention to keep my senario simple.

I will definately make more use of panels in later applications, but for now I want to keep things simple - especially the layout designs, which I am still having fun with with my very slow computer running the emulator which appears to move the cursor at 2 pixels per hour.... Oh to have a new computer

Thank you guys again - I really appreciate the advice you have given me over the last few weeks. I hope I can in return help other new starters in the future.

Shane
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…