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


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


3. In you Main file add below code

Download Source Code



Please enter your comment!
Please enter your name here