title: Displaying an array from xml resources in ListView not working
body: <p>I have an array in my resources that I want to display in a <code>ListView</code> but I'm failing miserably so maybe someone can tell what I'm doing wrong and what should I do to accomplish this. Here is the code I' using:</p>
  
  <p>In my XML resource:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
  &lt;string name="app_name"&gt;myApp&lt;/string&gt;
  &lt;string-array name="EstadosArray"&gt;
      &lt;item &gt;Estado1&lt;/item&gt;
      &lt;item &gt;Estado2&lt;/item&gt;
      &lt;item &gt;Estado3&lt;/item&gt;
      &lt;item &gt;Estado4&lt;/item&gt;
      &lt;item &gt;Estado5&lt;/item&gt;
      &lt;item &gt;Estado6&lt;/item&gt;        
  &lt;/string-array&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>In my Activity:</p>
  
  <pre><code>public class myMain extends Activity{
  String[] Estados;
  eAdapter ea=null;
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
  
      Estados = getResources().getStringArray(R.array.EstadosArray);
      ea = new eAdapter();
      ListView EstadosList = (ListView) findViewById(R.id.estadosList);
      EstadosList.setAdapter(ea);
  
  }
  
  class eAdapter extends ArrayAdapter&lt;String&gt; {
      eAdapter() {
              super(myMain.this, android.R.layout.simple_list_item_1, Estados);
              }
      public View getView(int position, View convertView, ViewGroup parent) {
          eHolder holder;
          if (convertView == null) {
              LayoutInflater inflater = getLayoutInflater();
              convertView = inflater.inflate(R.layout.esatdoitem, null);
              holder = new eHolder(convertView);
              convertView.setTag(holder);
          } else {
              holder = (eHolder) convertView.getTag();
          }
          holder.populateFrom(Estados.get(position));  // HERE IS WHERE I HAVE THE issue is, I DON'T KNOW HOW TO GET THE POSITION, IS GIVING ME AN ERROR (CANNOT INVOKE GET(INT) ON THE ARRAY TYPE STRING[])
          return (convertView);
      }
  
  }
  class eHolder{
      public TextView esname=null;
      eHolder(View row) {
          esname = (TextView) row.findViewById(R.id.ename);
      }
      void populateFrom(String est) {
          esname.setText(est);
      }
  }
  </code></pre>
  
  <p>I know that the issue is because string[] is not int but how can I fix that? That's how I will fill every row of my list.</p>
  
  <p>Edit: <code>LogCat</code> added:</p>
  
  <pre><code>05-03 17:09:46.290: E/AndroidRuntime(271):  at com.zvzej.jlgproapps.mexicoguia.myMain$eHolder.populateFrom(myMain.java:468)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at com.zvzej.jlgproapps.mexicoguia.myMain$eAdapter.getView(myMain.java:456)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.AbsListView.obtainView(AbsListView.java:1315)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.ListView.onMeasure(ListView.java:1109)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.View.measure(View.java:8171)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.RelativeLayout.measureChild(RelativeLayout.java:563)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:378)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.View.measure(View.java:8171)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.View.measure(View.java:8171)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.View.measure(View.java:8171)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.View.measure(View.java:8171)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.View.measure(View.java:8171)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.os.Handler.dispatchMessage(Handler.java:99)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.os.Looper.loop(Looper.java:123)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at java.lang.reflect.Method.invokeNative(Native Method)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at java.lang.reflect.Method.invoke(Method.java:521)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  05-03 17:09:46.290: E/AndroidRuntime(271):  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>