Android sharedpreferences tutorial

Posted on Nov 25 2017 - 5:57pm by Techy Hints

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:


About the Author

Geeky Magazine provides you with the daily latest technical news, reviews, startups, and every new in the internet world.