title: How to create AsyncTask on Android Java for charge Spinner from Firebase
body: <p>I try load a spinner with values as get from firestore, i have two class:
  1- the class what get values from firestore.
  2- the class what set this values on spinner.</p>
  <p>The step for charge is:</p>
  <ul>
  <li>Create an Instance ArrayList</li>
  <li>equal this to the another ArrayList get from firestore.</li>
  <li>Put this result on spinner</li>
  </ul>
  <p>The code is this:</p>
  <pre><code>ArrayList&lt;String&gt; Units = new ArrayList&lt;&gt;();
  
              Products units2 = new Products();
              Units = units2.getUnits(v, CompanySelected);
  
              //Units.add(&quot;Unidad&quot;);
              //Units.add(&quot;Caja&quot;);
              //Units.add(&quot;Pouch&quot;);
  
              Spinner UnitSelector = v.findViewById(R.id.Unit);
  
              ArrayAdapter&lt;String&gt; adapterUnitsSpinner = new ArrayAdapter&lt;&gt;(v.getRootView().getContext(),
                      android.R.layout.simple_list_item_1, Units);
  
              UnitSelector.setAdapter(adapterUnitsSpinner);
  </code></pre>
  <p>When i used at values what charge manually as commented on this code work fine, the spinner charge this and show item when touch, but when i get values from firestore only show this but dont select item.</p>
  <p>I tryed test the class as get values from firestore and works. The problem is on the code was showing.</p>
  <p>My think is what use an AsyncTask for get values and put this on ArrayList, but i dont understand how implement this.</p>