android - how to reload fragment on adapter class after item delete -
how can reload fragment adapter class after button click deleted item in database, fragment has recyclerview populated json array database.
because 1 of item deleted want recyclerview refresh item
heres code cartfragment , heres adapter button click comming.
i tried start same fragment
fragmentmanager manager = getsupportfragmentmanager(); manager.begintransaction() .replace(r.id.layout_for_fragment, new cartfragment()) .commit();
but getsupportfragmentmanager(); doesn't work inside adapter class, or there way around start same fragment on button click inside adapter.
call method inside holder.deleteitem.setonclicklistener(new view.onclicklistener() , pass object remove
private void removeitem(cartitem cartitem) { int currposition = cartitems.indexof(cartitem); cartitems.remove(currposition); notifyitemremoved(currposition); }
Comments
Post a Comment