title: spinner selected item change event triggers in initialization
body: <p>In my android app I have a spinner that I initialize with some categories</p>
  
  <pre><code>public void loadData()
  {
      Thread t=new Thread(new Runnable()
      {
          @Override
          public void run()
          {
              try
              {
                  String link="http://"+Static.host+"/allcategories/?format=json";
                  String json="";
                  URL url = new URL(link);
                  BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                  String line;
                  while ((line = in.readLine()) != null)
                  {
                      json += line;
                  }
                  in.close();
                  JSONArray elements=new JSONArray(json);
                  for (int i = 0; i &lt; elements.length(); i++)
                  {
                      JSONObject category=elements.getJSONObject(i);
                      spinnerArray.add(category.getString("title"));
                  }
                  runOnUiThread(new Runnable()
                  {
                      @Override
                      public void run()
                      {
                          spinnerAdapter.notifyDataSetChanged();
                      }
                  });
              }
              catch(Exception e)
              {
                  e.printStackTrace();
              }
          }
      });
      t.start();
      try
      {
          t.join();
      }
      catch (Exception e)
      {
          Toast.makeText(MainActivity.this,e.getMessage(),Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p>I created a function that will search articles based on the selected category</p>
  
  <pre><code>public void getArticlesByCategory(String category)
  {
      // I search articles and I display them in a listview
  }
  </code></pre>
  
  <p>Then I created an event listener for the spinner</p>
  
  <pre><code>spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
  {
      @Override
      public void onItemSelected(AdapterView&lt;?&gt; parentView, View selectedItemView, int position, long id)
      {
          getArticlesByCategory(spinner.getSelectedItem().toString());
      }
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; adapterView)
      {
      }
  });
  </code></pre>
  
  <p>Finally I call loadData in onCreate</p>
  
  <pre><code>loadData();
  </code></pre>
  
  <p>The problem is that the event is triggered in the initialization of the spinner, which causes getArticlesByCategory to be called every time a new element is added.</p>
  
  <p>I would like to know how I can trigger the event only when I manually select from the spinner.</p>