int txt= (int) parent.getItemIdAtPosition(position)
当我在Toast中显示txt
变量时,我的应用程序崩溃了,我需要获取所选商品的ID,然后将该ID保存在其他表格中,请帮忙
答案 0 :(得分:0)
spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String id = spinner.getItemAtPosition(position).toString();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});