title: Android - spinners inside a ListView
body: <p>i have a <code>ListView</code> with a custom <code>Servizio</code> object in every row. I'm using <code>SimpleAdapter</code> for this and it's ok.</p>
  
  <p>The problem is that i can't fill the spinner inside every <code>Servizio</code>. This code inside Servizio.java is causing my app to crash:</p>
  
  <pre><code>Spinner spinner = (Spinner) findViewById(R.id.spinner);
  
          int m = 3;//Integer.parseInt(camping.rulesList.getMaxPers().get(camping.tipSel));
  
          String[] array_spinner=new String[m];
          for (int indice = 0; indice &lt; m; indice++)
          {
              if (indice == 0) array_spinner[indice] = String.format("%d persona", indice+1);
              else array_spinner[indice] = String.format("%d persone", indice+1);
          }
  
          ArrayAdapter&lt;String&gt; aa = new ArrayAdapter&lt;String&gt;(getApplicationContext(), android.R.layout.simple_spinner_item, array_spinner);
          aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          spinner.setAdapter(aa);
  </code></pre>
  
  <p>The same code is working for a single spinner on the main activity... what am i missing?</p>
  
  <p>Thanks! ;-)</p>
  
  <p>UPDATE: Here's the Log... Maybe the problem is that "Attempted to add window with non-application token WindowToken"...</p>
  
  <blockquote>
    <p>01-11 16:23:06.038:
    WARN/dalvikvm(12582): threadid=1:
    thread exiting with uncaught exception
    (group=0x40028a00) 01-11 16:23:06.038:
    WARN/WindowManager(103): Attempted to
    add window with non-application token
    WindowToken{44ac0100 token=null}. 
    Aborting. 01-11 16:23:06.058:
    (...)</p>
  </blockquote>