Android Question List Sorting

Discussion in 'Android Questions' started by wonder, Jan 31, 2015.

  1. wonder

    wonder Expert Licensed User

    Hey guys,

    I have a few questions about lists.

    1. What the maximum number of items (int values) a list can support.
    2. To sort a big big big list, what's the best method/algorithm? Bubble sort? Quick sort?
    3. Is it feasible to import 8 megabytes of data to a list and sort it?
    4. Am I asking silly questions and should I just learn how to "database", mySQL and such? :D
    Last edited: Jan 31, 2015
  2. susu

    susu Well-Known Member Licensed User

    With 8MB of data, I think SQLite is the best. You can sort it with only one query SELECT ... ORDER BY..
    KMatle and thedesolatesoul like this.
  3. KMatle

    KMatle Expert Licensed User

    As the table you store the data in is a file, this should be no problem. What kind of data is it
  4. wonder

    wonder Expert Licensed User

    It could be, for example CSV values.
    Username, Score, Endurance Time.
    user000001, 128329
    Sort by highest score. Endurance time as a tie-breaker.
    If the score is the same, the highest ranked user is the one with the highest endurance time.

    Anyway, I'm starting to realize I really have to take the "database-on-a-server" path.
    My initial idea was to have my game downloading the entire scoreboard, updating it, sorting it, displaying it and re-uploading it using lists.
    This could be fine for a few dozen users, but if I ever reach thousands, I guess this system would break.
  5. inakigarm

    inakigarm Well-Known Member Licensed User

    Db estructure permits great flexibility: Sorting By highscore and endurance time is very quick and easy with SQL (sqlite or MySQL)
    wonder likes this.
  6. RandomCoder

    RandomCoder Well-Known Member Licensed User

    While we're on this subject, what is the preferred database? I recently installed MySQL, but only yesterday I read this post MySQL Library about licensing when using a JDBC driver. Does this rule out using MySQL in any Apps we intend to sell? I've not looked properly into it yet but would appreciate a simple answer.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice