title: spinner item selection inside button onclick not working
body: <p>Below inside my adapter class as i will get data inside button click i want to populate spinner inside button click and set item selected listener in it.</p>
  
  <pre><code>tvMediaCategory.setOnClickListener(new OnClickListener()
      {
          @Override
          public void onClick(View v)
          {
              // TODO Auto-generated method stub
  
                      for(int i=0; i&lt;mediaList.get(position).getMediaCatList().size(); i++)
                      {
                          catArr[i] = mediaList.get(position).getMediaCatList().get(i).getCategoryName();
                      }
                  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                  for(int i=0; i&lt;catArr.length; i++)
                  {adapter.add(catArr[i]);}
                  adapter.add("HINT_TEXT_HERE"); //This is the text that will be displayed as hint.
  
                  spinner.setAdapter(adapter);
                  spinner.setSelection(adapter.getCount()); //set the hint the default selection so it appears on launch.
                  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                      @Override
                      public void onItemSelected(AdapterView&lt;?&gt; parent, View view,
                                                 int position, long id) {
                          Log.v("item", (String) parent.getItemAtPosition(position));
                          Toast.makeText(context, "position clicked "+position, Toast.LENGTH_SHORT).show();
                      }
  
                      @Override
                      public void onNothingSelected(AdapterView&lt;?&gt; parent) {
                          // TODO Auto-generated method stub
                      }
                  });
                  tvMediaCategory.setVisibility(View.GONE);
                  spinner.setVisibility(View.VISIBLE);
                  spinner.performClick();
  
                  //showCategoryDlg(catArr, position, selectedPos, tvMediaCategory);
  
              }               
          }
      });
  </code></pre>
  
  <p>here my spineer not getting open but selecting default item. how to make it work. this my code is inside a adapter. how can i show my spinner items on click of button?</p>