• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Listview Simplecursoradapter move to record [SOLVED]

timcs

Member
Hi

I feel pretty stupid asking this question even after spending hours trying to get it working and searching via google with seemingly little luck (it is usually because I am searching using the wrong terminology ).

My app is mainly made up of a listview linked to a simplecursoradapter (custom one I might add) which in turn uses a cursor which gets the data fed in from a dbadapter class.

using the dbadapter class I can retrieve data using the rawquery and query methods no problem. However I am trying to allow the user to enter a month in and then the app will scroll to that month in the list , instead of the user having to scroll through several months to get there.

This is where I am struggling, I have tried to move to the position within the original cursor and then calling changeCursor from the simplecursoradapter with no luck and tried using the listview with smothscrolltoposition again with no luck and even tried to notifydatachangedset (probably got that named wrong) and then within the custom simplecursoradater try and move to it but that does not work either.

Please can someone point me in the right direction

Thanks

TimCS
 
Yes I was being stupid but I think the terminology of the method that I have now used is a little misleading. To move to a record with a listview which is linked to a simplecursoradapter , using the listview object use the setSelection(postition) method.

Also (as I have learnt as well) when getting the position to move to , use the cursor object linked to the simplecursoradapter not a cursor from your SQLite Database class.

Thanks

TimCS
 
Back
Top Bottom