O
O
open0322018-09-24 05:00:43
Android
open032, 2018-09-24 05:00:43

Which adapter to use?

You need to make a list of editable items,
with two icons that change depending on the checkbox in the checkbox, a button with adding / deleting / editing an item, by clicking on the Back button, display Alert with a suggestion to save the item, if the field has been edited, the changes should be remembered after closing the application .
Which adapter to use, write your own, or will one of the standard ones suit me?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-09-24
@open032

You have a vague question, but oh well.
1) You need to write your adapter operating on POJO with two fields, resource id and explanatory text. Those.

public class YourAdapter extends ArrayAdapter<YourPojo>

2) You need to attach a Listner to the checkbox to change the click state of the checkbox, in the body of which you edit the adapter collection, setting the necessary resource icon ids and notifying the list that the adapter data has changed.
3) You need to extend your activity's onBackPressed() in such a way as to check if the list has been edited. You can do this in many ways, for example, use the boolean flag.
4) To save your list, you can save it as a JSON array in the phone's internal memory or in a SQLite database table. Or a million more ways to your taste.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question