Xamarin.Android how to save textview values inside of a recyclerview item

£可爱£侵袭症+ 提交于 2020-06-29 04:08:09

问题


I have implemented a reorder recyclerview in my app as per the following link:

https://www.appliedcodelog.com/2019/08/reorder-list-items-by-drag-and-drop-in.html

The user can add and click on any of the items to change the qty and unit type and also add the price of the item via a custom dialog (see attached screen shots).

Currently the item names are saved by converting the list to Json. So when the app is reopened the items are loaded back into the list.

My question is, how can I also save the qty, unit type and price (if set) so that the app remembers if any of these are set and displays them on the relevant items?

The textviews for the qty/unit and price are set to View States.Gone to begin with, then if the user changes any of them, the view states are set to visible and the user entered text is displayed in the list item.

This method doesn't seem to be working very well because if I add another item, sometimes the qty of one item is displayed in a different item.

How can I save the values of the qty/unit/price so that on reopening of the app, the correct values are displayed in the correct items?

Hope this makes sense.

screenshot

[screenshot 2] (https://i.stack.imgur.com/6aw2V.jpg)

来源:https://stackoverflow.com/questions/62465675/xamarin-android-how-to-save-textview-values-inside-of-a-recyclerview-item

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!