Undo the changes in listview onbackpressed

后端 未结 1 636
夕颜
夕颜 2021-01-26 07:56

I have a list view which contains list of products and on the click of the list item, list details gets open. The list item contains values like gross weight, net weight etc.

相关标签:
1条回答
  • 2021-01-26 08:41

    There a simple way to achieve this

    let's say you have a Product class

    public class Product{
        private boolean currentState;
        private boolean previosState;
    }
    

    Maintain the currentState when user clicks on the cross button but do not touch the previousState.

    Now on the yes or no selection when press Yes consider the currentState and when press No consider the previosState.

    0 讨论(0)
提交回复
热议问题