Checking if spinner is selected and having null value in Android

后端 未结 6 831
庸人自扰
庸人自扰 2021-01-12 09:27

I want to check first if spinner has null values based on the following:

String Name= spinnerName.getSelectedItem().toString();
if(Name != null) {     
} els         


        
6条回答
  •  日久生厌
    2021-01-12 10:05

    if (spinner1.getCount()==0){
       Toast.makeText(getApplicationContext(),"spinner hasn't values",               
       Toast.LENGTH_LONG).show();
     }
    

提交回复
热议问题