Values not getting shown in spinner I am getting values when I click on spinner , dropdown get shown with values . But not when I select the spinner
vechType_spinner.setOnItemSelectedListener(new OnItemSelectedListener()
{
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3)
{
if (position != 0)
{
Toast.makeText(CreateItinerary.this, "testing vehicle", Toast.LENGTH_LONG).show();
selectedVehicalType = vechiclelist.get(position);
if (selectedVehicalType.contains("Car") || selectedVehicalType.contains("Motor Cycle") || selectedVehicalType.contains("Bike"))
{
expectedKM.setVisibility(View.VISIBLE);
//classSpinner.setVisibility(View.GONE);
}
else
{
expectedKM.setVisibility(View.GONE);
}
}
else
{
Toast.makeText(CreateItinerary.this, "testing else vehicle", Toast.LENGTH_LONG).show();
expectedKM.setVisibility(View.GONE);
//classSpinner.setVisibility(View.GONE);
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0)
{
Toast.makeText(CreateItinerary.this, "testing NOthing selected vehicle", Toast.LENGTH_LONG).show();
}
});
onItemSelected is not getting called . Although the items get drop down ? Is it due to xml overlapping ??
try like this in your code, make change in OnitemSelelected will work
Add inside Oncreate