Skip to content

Remember last selection

Harsh B. Bhakta edited this page May 5, 2019 · 2 revisions

For some use-cases it is required that selection of country remains unchanged when app is restarted or activity is relaunched.

How to enable?

  • To enable this, add app:ccp_rememberLastSelection="true" in XML of your CCP.
  • First time when there is no history of country selection, it will set default country or auto-detected country (if autoDetectCountry is enabled) in CCP.
  • Now whenever user will select some country from a CCP dialog, that will be recorded on shared preferences.
  • From next run, this will load last selected country and override default country or autodetected country.

More than one CCP?

  • If you are working with multiple CCP views, you might want to save different selections for each.
  • Simply by providing different memory tags, different selections will be maintained for each CCP.
  • To specify tag, add app:ccp_selectionMemoryTag="anyDifferentString" to CCP along with app:ccp_rememberLastSelection="true" in XML of CCP.
Clone this wiki locally