0
我已經填充了一個ListView,從數據庫中調整數據。當然,每個列表項目具有相同的佈局。在這個佈局中有一些按鈕,複選框和其他小部件。Android:ListView和每個列表項onClick動作
現在我想設置onClickListenser。如何實現這一目標?
這裏是概述:
我有什麼:
private void populateListView(){
DatabaseHandler db = new DatabaseHandler(this);
Cursor alarms = db.getAllAlarms();
startManagingCursor(alarms);
String[] time = new String[]{DatabaseHandler.KEY_TIME};
int[] toViewIDs = new int[]{R.id.timeTitle};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(
this,
R.layout.per_alarm_activity,
alarms,
time,
toViewIDs
);
ListView listView = (ListView) findViewById(R.id.allAlarmsView);
listView.setAdapter(adapter);
mTimeView = (TextView) findViewById(R.id.timeTitle);
mAmPmTextView = (TextView) findViewById(R.id.amPmTextView);
mAlarmOnOff = (Switch) findViewById(R.id.alarmOnOff);
mRepeatCheck = (CheckBox) findViewById(R.id.repeatCheckBox);
mDrop = (ImageView) findViewById(R.id.arrowDown);
mUp = (ImageView) findViewById(R.id.arrowUp);
}