1. Are you ready for the Galaxy S20? Here is everything we know so far!

Listview Simplecursoradapter move to record [SOLVED]

Discussion in 'Android Development' started by timcs, Dec 8, 2013.

  1. timcs

    timcs Member
    Thread Starter

    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
     



    1. Download the Forums for Android™ app!


      Download

       
  2. timcs

    timcs Member
    Thread Starter

    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
     
Loading...
Similar Threads - Listview Simplecursoradapter move
  1. zelaine2
    Replies:
    3
    Views:
    316
  2. Jhearcht2
    Replies:
    3
    Views:
    430
  3. behrprofl
    Replies:
    10
    Views:
    606
  4. corvairbob
    Replies:
    2
    Views:
    423
  5. Danno175
    Replies:
    23
    Views:
    3,723
  6. NewbAndroidUser
    Replies:
    35
    Views:
    9,061
  7. sancho_s
    Replies:
    3
    Views:
    999
  8. thequeenscheese
    Replies:
    13
    Views:
    1,200
  9. Achal Mehra
    Replies:
    0
    Views:
    673
  10. frappydan
    Replies:
    6
    Views:
    2,031

Share This Page

Loading...