, AndroidMkab

Android Shared Preferences – AndroidMkab


In this post I will show you how to save values to Shared Preferences and how to retrieve when ever you want the data back. Shared preferences store data locally in phone itself. Lets see the method on how to do it.

Watch Video for better understanding

  1. Create an XML Layout which contains two EditText Views, two Buttons and Two TextViews as shown in below screenshot

, Android Shared Preferences – AndroidMkab, AndroidMkab, AndroidMkab

2. To Achieve Above design Add below code to your XML File


3. In you Main Activity.java file add below code

Download Source Code

Karthik M