Android Question [Solved] which view for a list with two cells?

Pflichtfeld

Active Member
Licensed User
I need a scrollable list with two cells, each of which contain a corresponding number.
Should I take a B4xTable or what would you recommend for that?
Should look something like:
 

Pflichtfeld

Active Member
Licensed User
Sorry: I forgot one feature: It should be possible, to set line/item xy visible in view / in mid of view programmatically

Where do i find Flexible Table?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I wouldn't use the B4XTable, it is not vertically scrollable.
I wouldn't use the Flexible Table either, it's too complicated for such a simple layout.
I would use something based on a ScrollView with Labels, based on THIS, it's an old example but simple and easy.
You could also use the xCustomListView, a 'standard' library, but I think that it's also complicated for your simple layout, but it has the advantage it's cross-platform.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Did not see the way, to set a certain row visible by code.
The rows are all visible.
Or do you want to hide some rows?
Then you need to add method.
You need to memorize which rows are hidden and set the height of the hidden rows to 0 and move the rows below by changing their Top properties.
Then, depending on the number of rows, what is easier hide rows or refill the whole list?

By the way, Flexible Table is based on a ScrollView with Labels, and xCustomListView is also based on a ScrollView with Panels for each row.
If I remember well, both have the row hide method.
Just for comparison, the Flexible Table class has about 3400 lines of code.
The example I suggested in post#5 has 220 lines of code.
The xCustomListView, an older version, has 620 lines of code.
 
Last edited:
Upvote 0

Pflichtfeld

Active Member
Licensed User
The rows are all visible.
Or do you want to hide some rows?
What I need is, that a row, you have scrolled to, stays in Position, if you rotate phone or otherwise: I'd like to remember/save the last viewed row and set the listview on this row, next time the app is started.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Not complicated.
You need to memorize the selected row in a process global variable and scroll to it in Activity_Resume.

Attached the TableExample project with the memorized row.
 

Attachments

  • TableExample1.3.zip
    13.8 KB · Views: 114
Upvote 0

Pflichtfeld

Active Member
Licensed User
Oh, that is very interisting! Thank you Klaus! I could not cope with this .scrollposition-property, but now I understand it.
In my case, the user will not select an entry, he just scrolls and searches certain rows/values. So: I cannot find a scroll-event for saving the present viewed row, will say, the row (values), the user was interested in. Do I have to use a timer for this, which every short intervall saves the current view-position or is there a more elegant way?
Thomas
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
So: I cannot find a scroll-event for saving the present viewed row ...
You have never asked for it!?
Without knowing what exactly you want to do, how do expect us to give THE advice YOU want !?
Explain exactly what you need or want to do, so we could give a concrete answer to your problem.
After each answer you have a new request, this is getting boring.

You can easily add the SV_ScrollChanged event and save the current position and mange it to your needs!
 
Upvote 0

Pflichtfeld

Active Member
Licensed User
You have never asked for it!?
You can easily add the SV_ScrollChanged event and save the current position and mange it to your needs!
Ok, Klaus, I take the blame, no doubt. I am really sorry for that.
As I am used to code in VB.Net and as I am totally new here, I am thinking in these NET-categories with powerfull controls, providing everything one asks for. I am learning, that coding in android is very different. So I beg you to be indulgent with me. I thought, my intention would be clear after my second posting.
I seems not to be difficult with this SV_ScollChanged event. Thank you for your help and for your hint!
(It is so difficult for me, to find out the possibilities in B4a. F.i. in the scrollview-tutorial the scrollchanged event is not mentioned, the intellihelp (or whats its name) just shows properties and functions, there is - as far as I know - no overview for the particular views like I know them from VB.Net. Instance for a listview in VB.NET here. Maybe these overviews exist, but then they are hard to find. I have installed both of the help-projects (browser.exe, B4xhelp.exe), but even there: no hint for this event.)
But again: sorry and thank you for your patience!
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…