Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void bindView(View view, Context context, final Cursor cursor) {
- // id starts from 1. So that's why I add 1 to the current cursor's position.
- final int id = cursor.getPosition() + 1;
- final Alarm alarm = dbHelper.getAlarm(id);
- TextView tvSetAlarmTime = (TextView) view.findViewById(R.id.tvSetAlarmTime);
- String strAlarmTime = alarm.getAlarmTimeString();
- tvSetAlarmTime.setTextColor(ContextCompat.getColor(context, R.color.dark_grey));
- tvSetAlarmTime.setText(strAlarmTime);
- Switch switchAlarmOnOff = (Switch) view.findViewById(R.id.switchAlarmOnOff);
- boolean active = alarm.isAlarmActive();
- switchAlarmOnOff.setChecked(active);
- switchAlarmOnOff.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- }
- });
- ...
- ImageView ivDelete = (ImageView) view.findViewById(R.id.ivDelete);
- ivDelete.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- dbHelper.deleteAlarm(id);
- cursor.requery();
- notifyDataSetChanged();
- }
- });
- 01-19 19:31:46.298 19339-19339/com.marshall.alarm E/AndroidRuntime: FATAL EXCEPTION: main
- Process: com.marshall.alarm, PID: 19339
- java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
- at com.marshall.alarm.ui.AlarmListFragment$AlarmListAdapter.bindView(AlarmListFragment.java:192)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement