• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQLite ordering

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a table that i currently use to fill a spinner with in alphabetical order, i was wondering if there was a way where i could set a certain row as always top then order the rest below it in alphabetical order?



thats the code im currently using
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think what you actually want to do is pre-select a certain item in your spinner. Yes, you could arrange the data in broken alphabetical order, but it's a lot of work and it's likely to confuse the user. So instead of doing database tricks, I'd recommend that you simply pre-select the spinner to the preferred value.
 
adrian rowlands
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ye I can do that but I have an show all option in the spinner and id like that to always be first so the user doesn't have to go search for this
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably the easiest thing to do then, would be to take the List of returned items, remove the preferred element from the list and re-add it to the top. Doing it in SQL is an ugly process and I'm not even sure SQLite's SQL capabilities extend to some of the features required.
 
reply
    Bookmark Topic Watch Topic
  • New Topic