我在我的android应用程序中使用一个微调器下拉,我正在使用一个列表,我需要在我的下拉列表中绑定数据。但是我没有得到我在列表中设置的内容而不是它显示“com.example.testuser.applicationmae.class”。
下面我附上了我用过的代码
desiginations = EmpDtls.getDesiginations();
spinnerOfferType = (Spinner) findViewById(R.id.spinnerOfferType);
ArrayAdapter<Desigination> adapter = new ArrayAdapter<Desigination>(
this,android.R.layout.simple_spinner_item ,desiginations);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerOfferType.setAdapter(adapter);
员工类如下
public class EmpDtls {
public String EmpName;
public String EmpJDate;
public static List<Desigination> getDesiginations(){
List<Desigination> desiginations = new ArrayList<Desigination>();
Desigination desigination = new Desigination();
desigination.id = 1;
desigination.name = "Application Developer";
desiginations.add(desigination);
desigination = new Desigination();
desigination.id = 2;
desigination.name = "Manager";
desiginations.add(desigination);
return desiginations;
}
}
我的指定课程如下
public class Desigination {
public int id;
public String name;
}