title: android - Don't want show the spinner dropdown if it is empty
body: <p>I don't want to show the spinner drop down if it is empty. I tried but i am not getting please can anyone help me.</p>
  
  <p>code:</p>
  
  <pre><code>sp.setOnTouchListener(new OnTouchListener() {
  
      @Override
      public boolean onTouch(View arg0, MotionEvent event) {
          // TODO Auto-generated method stub
          //narray is the array. It's having the elements of spinner.
          if (event.getAction() == MotionEvent.ACTION_UP &amp;&amp; narray.size() == 0) {
              sp.setPressed(false);
              sp.setSelected(false);
              sp.setAdapter(null);
          }
          return false;
      }       
  });
  </code></pre>