如果我有2個微調依賴型的ArrayList>微調和onItemSelected
spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
ArrayList<HashMap<String, String>> arrList = new ArrayList<HashMap<String,String>>();
for (HashMap<String, String> map2 : arrList) {
String value = map2.get("SectionID");
// Do something
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, value, duration);
toast.show();
Log.d("wwwwwwwwwwwwwwwwwwww: ", value);
// Do something
}
}
@Override
public void onNothingSelected(AdapterView<?> adapter) {
}
});
我非常喜歡這一點,但kothing happend和logcat的沒有錯誤
難道你不能獲得物品ID嗎? –
使用id來區分。 –
我不明白你可以解釋...我的意思是我會得到的位置,然後課程編號 –