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) {
- TextView tvSelectedAllergy = (TextView) view.findViewById(R.id.tvSelectedAllergy);
- ImageButton bDeleteSelectedAllergy = (ImageButton) view.findViewById(R.id.bDeleteSelectedAllergy);
- tvSelectedAllergy.setText(cursor.getString(cursor.getColumnIndex(PrepopulatedDatabase.ALLERGY_KEY_NAME)));
- bDeleteSelectedAllergy.setOnClickListener(new ImageButton.OnClickListener() {
- @Override
- public void onClick(View v) {
- //Whenever I click an item in the list it just deletes the last one. I guess because the cursor is at the last position? But still... shouldn't this add a new OnClickListener for each item in the list with the data from the cursor at the runtime?
- ppd.deleteItem(PrepopulatedDatabase.ALLERGY_TABLE, PrepopulatedDatabase.KEY_ID, cursor.getString(cursor.getColumnIndex(PrepopulatedDatabase.KEY_ID));
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement