In this tutorial you will about android sharedpreference api and how to use sharedpreference api to store and retrieve a color that later will be used for coloring android toolbar and android statusbar.
Here is how to do it:
- Create 3 android buttons that will each hold a color
- Make those buttons clickable by using Android setOnClickListener
- Define Sharedpreference and make sure the mode is set to private
- Define Sharedpreference.Editor to be able to edit sharedpreference file and store color
- Inside setOnClickListener store the color inside sharedpreference and use the same color for Android toolbar and Android statusbar.
That's it!!
Social media:
▶Twitter: https://twitter.com/codingdemos