Tuesday, April 21, 2015

Simple SharedPrefences Example in Android

In this post, we will learn about how to use sharedPreferences in android studio with an easy example. So first let's make a new project on Android Studio :
After that, go to layout configuration and change your xml file as shown below (please click on picture to enlarge) :
After configuring our xml layout, next let's go to main activity. Put these code in it :
Yaaaaikzzz.... That's all of it... Let's run our project on real device :
After pressing "save" button, then close your application. Then open it again, now you'll see that your data is still there... This is the simple example of how to use sharedPreferences in android...
Thanks... :-)

No comments:

Post a Comment