title: android: string-array size limit for AutoCompleteTextView
body: <p>I would like to have an autocomplete feature for my user when they enter text in the text box. This is easily achievable with AutoCompleteTextView in android. Initially, I build my string array in /res/values/strings.xml as </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
  &lt;string-array name="autocomplete_list"&gt;
      &lt;item&gt;text 1&lt;/item&gt;
      &lt;item&gt;text 2&lt;/item&gt;
      &lt;item&gt;... (many more) ...&lt;/item&gt;
      &lt;item&gt;text 1499&lt;/item&gt;
      &lt;item&gt;text 1500&lt;/item&gt;
  &lt;/string-array&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>In my java code, i have</p>
  
  <pre><code>    // load autocomplete list
      String[] textList= getResources().getStringArray(R.array.autocomplete_list);
      myAutoCompleteTextView.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.autocomplete_list, textList));
  </code></pre>
  
  <p>This worked fine when I only have a few things on my string. However, if my list is really long, say over 1000 items, i get run time error. The application will close on its own without any warning (no app forced closed error). It just disappears. Nothing in the logcat. </p>
  
  <p>So am i exceeding maximum element indexable in string array in Java? is that what's causing the problem? If so, anyone knows what the max is? It does not seem like a memory problem since i don't get the OutOfMemory error. </p>
  
  <p>Edit:</p>
  
  <p>So apparently this is widely known problem, seems like a limit on the getResource().getStringArray() limitation</p>
  
  <p><a href="https://stackoverflow.com/questions/3522181/should-i-be-using-something-other-than-getresource-getstringarray-to-populate">Should I be using something other than getResource().getStringArray() to populate a large array?</a></p>
  
  <p>Going to try his solution first to see how well it works, but if you know a better way to do it, please feel free to share. Thanks!</p>