I have a custom listview item that includes a 'remove' button. I created a custom adapter called LazyListAdapter
that extends BaseAdapter
. Inside the getView method that I override I set this button's onclick method as follows:
@Override
public View getView(final int pos, View convertView, ViewGroup parent) {
View v = convertView;
// Some other things...
ImageButton removeFav = (ImageButton) v.findViewById(R.id.removeFavorites);
removeFav.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// I delete the object from Parse database here,
// Therefore I want the view to disappear here
}
}
How can I delete or somehow hide the corresponding view by using a code inside this onclick method? Or should I change my approach?
Thank you so much in advance.
notifyDataSetChanged()
inonClick()
; – DuntsonnotifyDataSetChanged()
actually worked pretty flawless. Thank you very much @SankarV – Bort