How to scroll to the new added item in a ListView
- by Thomas
Hi all
My application show a ListView with a button which allow user to add an element. When the user clicks on this button, another Activity is started to allow user to populate the new element. When the add is finished, we return to the previous Activity with the ListView and I would like to scroll to the new element.
Note that this element is not necessarily at the end of the ListView because there is an "order by" when I retrieve the datas from the database.
I know I need the cursor position of the new element to make the ListView scrool to it, but the only info I have about this element is its id, so how to convert this id to cursor position ? Do I have to loop on the cursor to find the position ?
Thanks in advance