我想在運行時設置android微調器項目值。Android微調器設置值
這是我到目前爲止有:
final ArrayAdapter<String> calsListAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, calendarNames);
eventCalendarList.setAdapter(calsListAdapter);
eventCalendarList.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
calendarChoosen = availableCals.get(arg2);
}
public void onNothingSelected(AdapterView<?> arg0) {
Logger.d("Cal Choosen", "fffffffffffffff");
}
});
private List<AvailableCalendar> availableCals = new ArrayList<AvailableCalendar>();
private AvailableCalendar calendarChoosen;
但沒有設置值。如何做呢?
張貼一些代碼。您的解釋不夠清楚,無法理解問題。 – 2012-07-25 18:44:51
@DavidWasser代碼如下:final ArrayAdapter calsListAdapter = new ArrayAdapter ( this,android.R.layout.simple_list_item_1,calendarNames); \t eventCalendarList.setAdapter(calsListAdapter); \t \t \t eventCalendarList \t \t \t \t \t .setOnItemSelectedListener(新OnItemSelectedListener(){ \t \t \t \t \t \t公共無效onItemSelected(適配器視圖>爲arg0, \t \t \t \t \t \t \t \t查看ARG1,ARG2 INT, long arg3){ \t \t \t \t \t \t \t calendarChoosen = availableCals.get(arg2); \t \t \t \t \t \t} \t \t \t \t \t \t公共無效onNothingSelected(適配器視圖>爲arg0){ \t \t \t \t \t \t \t Logger.d( 「校準Choosen」, 「fffffffffffffff」); \t \t \t \t \t \t} \t \t \t \t \t}); –
dominic
2012-07-26 06:05:18
private List availableCals = new ArrayList (); private AvailableCalendar calendarChoosen; –
dominic
2012-07-26 06:18:48