Android in-memory value pairs vs. SQLite
<p>What is the best way to store a large amount of value pairs if I need them during the dynamic behavior of the application? In memory (e.g. LinkedHashMap) or SQLite DB?
I have more than 4000 rows of personID and personName and I need an EditText and a Spinner. If I enter the proper personID in the EditText the Spinner should jump to the right personName, but the Spinner should contain all personsNames as well.</p>

<p>Currently I have implemented the "in memory" solution on the following way, because a simple array can't be larger than 64k. The code was of course generated. I've also tried to define the arrays in XML, but it also has the same limit.</p>

<pre><code>public enum CompPeople {
    INSTANCE;

    public LinkedHashMap&lt;Short, String&gt; peopleIDs = new LinkedHashMap&lt;Short, String&gt;();

    public void initialize() {
        peopleIDs = new LinkedHashMap&lt;Short, String&gt;();
        setPeople1();
        setPeople2();
        setPeople3();
        setPeople4();
    }

    public void setPeople1() {
        peopleIDs.put(new Short((short) 1011), "John Doe");
        peopleIDs.put(new Short((short) 1012), "Jack Knight");
        peopleIDs.put(new Short((short) 1013), "Sue Doe");
        ...
    }

    public void setPeople2() {
        ...
    }

    public void setPeople3() {
        ...
    }

    public void setPeople4() {
        ...
    }
}
</code></pre>

<p>If the SQLite way would be better, is there a better solution to initialize a database at first run of the application than the one described here?:
<a href="http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/" rel="nofollow">http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/</a></p>

<p>Thanks in advance!</p>
