Android: Best practice for dealing with large arrays

I have over 150 sounds in my raw folder and it has become quite tedious trying deal with them. I have a soundboard that dynamically takes all the sounds in my int file[] array and matches it with the title in the string soundnames[] array. These arrays are then translated to a custom button adapter for a gridview. The arrays are in alphabetical order (done manually) to have some form. The problem is that when I have to go to add new sounds I have to very carefully find where it falls in the current array and match it perfectly so the string names and files match correctly. Since the two arrays have to match up that means I have 300+ items I have to keep track of and has become overwhelming. Is there a way to that I could add new songs to the end of these arrays but have them alphabetically sorted so they would match up still while still having order to the array.

Is there an easier or more efficient way of dealing with large mutually exclusive (not sure if that is the right word) arrays? Also I have some sound files that have a generic name i.e. sound 1.. sound N which I would like to keep at the end of the array would that be possible as well?

Answers


Put the data in an sqlite database and use cursors. SQL allows sorting and is very fast at it.


You can use collection classes

you can use

  • List
  • HasMap

As per your requirement you want sorted data.

use SortedMap


Need Your Help

How does undo/redo basically work on iPhone OS?

iphone ios undo-redo

My app doesn't use Core Data yet. Is it true that I must use Core Data for undo/redo?

Android App not crashing when inserting row into SQLite database

java android eclipse sqlite android-sqlite

Hi I'm new to Android development and am trying to make an app that takes a users first and last name, zip code, age and sex add them to a SQLite database and then display it on the next page. I have