• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Recall selections when using .setMultiChoiceItems with AlertDialog  RSS feed

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented multiple checkboxes in an AlertDialog. However, I am now looking for a simple way to recall the selected checkboxes if the AlertDialog is reopened.

The issue arises here...



A new instance of the AlertDialog is called every time. So, I was supposing that if there was a way to preserve the previous state, that should do the trick. Does anyone have experience doing this? Or suggestions?

Thanks y'all!
 
Adam Wentz
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, after doing extensive digging, I came across this tutorial:

Show/Create AlertDialog with multiple choices in android

It resolves the issue of recalling previous selections in the checkbox AlertDialog by utilizing a boolean array. It needed only minor tweaking to make it work perfectly for my purpose.

In the event that the aforementioned page should become unavailable in the future, here is the code from the referenced tutorial:

MainActivity.java



activity_main.xml
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!