How to set my first value (default value) in spinner as empty. Means, until the user selects value from list, spinner will have no value. I tried below
list.add("");
But, it won't work. Below is my code :
if(values.contains("options")){
spinner.setOnItemSelectedListener(MyClass.this);
List<String> list = new ArrayList<String>();
list.add("");
list.add("Test");
list.add("Working");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_item, list) {};
adapter.setDropDownViewResource(R.layout.custom_spinner_list);
spinner.setAdapter(adapter);
}
}
i found out the way. Here is how we do it, let the last line be
and add below code :
Thanks to user45678's answer above, I wrote this