0

I am working on restaurant app. In that, i have cart activity. That, I manage with the database. When the user adds an item, i insert it to a database.

I created one class that extends ArrayAdapter

  • in this class, i display data of each item in the cart.
  • when user finalizes cart items, i post it to WebService.

Problem

  • in this cart, itemi have a button "remove this item."
  • when I click on it, item is deleted from the database but not reflecting on ArrayList.

adapter.notifyDataSetChanged() not working.

NOTE

when I go back to that activity and come, it will be removed.

1
  • PUT your code here, people dislike your question ....... Commented Apr 20, 2016 at 12:05

1 Answer 1

1

Just remove the item from Arraylist.

yourArraylist.remove(poistion);

Then you notify to adpter changed by below code

adapter.notifyDataSetChanged();

Try this it may help you.....

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.