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.
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 && narray.size() == 0) {
sp.setPressed(false);
sp.setSelected(false);
sp.setAdapter(null);
}
return false;
}
});
add this in your code to check array size is <= 0
try this code spinner not open.
Edited :
do like below