Skip to content Skip to sidebar Skip to footer

Two Cardview Created, When Trying To Update The Cardview

I'm trying to design a page where address are stored in recycler view -> cardview. When the user clicks the add address button from the Activity A the user is navigated to the a

Solution 1:

You're doing the same mistake again.

Reinitializing List and adapter every time in onActivityResult, so every time your data length 1 because the list is Reinitialize and add new data.

For your current situation

You can not edit already added list data. so you need to do 2 things pass cardView or list position to activity 2 and after successfully editing pass position to activity 1 again. so now you have a position. In onActivityResult removeData from list using position Like list.remove(position); and after removing add data to that position like. list.add(position,data);

Post a Comment for "Two Cardview Created, When Trying To Update The Cardview"