Попробуйте этот код, возможно, он вам поможет
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
if(parent.getId() == R.id.spinner1)
{
String text1 = spinner1.getSelectedItem().toString();
}
else if(parent.getId() == R.id.spinner2)
{
String text2 = spinner2.getSelectedItem().toString();
}
}
ИЛИ попробуйте другой способ
ArrayList<LocationObjects> country=new ArrayList<>();
ArrayList<LocationObjects> country1=new ArrayList<>();
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
if(parent.getId() == R.id.spinner1)
{
String text1 = country.get(position).getLocationName();
}
else if(parent.getId() == R.id.spinner2)
{
String text2 = country1.get(position).getLocationName();
}
}