简体   繁体   中英

How to save checkbox state in the list in Android app?

我该如何在Android Studio中制作待办事项应用程序,并在列表中写入的每个项目前面都带有复选框,并且每当我选中或取消选中某个项目时,每次打开该应用程序时都应保持不变。如果有人拥有此代码,请共享代码它。

On your main layout you should have 3 elements

  1. EditText -- used to write the new task
  2. Buttom -- used to add a new task
  3. ListView -- used to show your task lists

You should implement a List Adapter to manage your task data and a list view cell layout.

this layout should have a TextView to show your task and a CheckBox.

To keep your data when your app is opened, try to investigate about SQLite and how to used. I don't think much people like to share code but this is really simple, try it yourself

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM