title: Populate Spinner with async call to Web Service only when clicked
body: <p>I have a few spinners in my Android Activity class that need to be populated with data from a web service. I have already set up methods that invoke the web service call. Once the web service returns data and it is parsed, I populate the respective data into an <code>ArrayList</code> member of my class. The problem is that I do not know how to invoke these calls only upon a user selecting a particular spinner. For instance, I use the following code to bind <code>countrySpinner</code>:</p>
  
  <pre><code>    countrySpinner = (Spinner) findViewById(R.id.spinner_country);
  
      List&lt;String&gt; list= new ArrayList&lt;String&gt;();
  
      list.add("All"); // &lt;-- initial/default content
  
      countryAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, list);
      countryAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      countrySpinner.setAdapter(countryAdapter);
  </code></pre>
  
  <p>The default value is "All" which is fine because that is the default behavior of the web service. However, I want to invoke the method <code>callSpinnerWS()</code> when a user touches the spinner, then populate its data again by modifying the member <code>countryAdapter</code> to have a list more to my liking by <code>countryAdapter.clear()</code> and then iterating over a different arraylist to add items.</p>
  
  <p>Where do I put the call to the web service? What is the appropriate binding event for accomplishing this?</p>