SlideShare ist ein Scribd-Unternehmen logo
1 von 16
1 
Activities, Intents 
and 
Shared Preferences 
for 
Persistence
SIMPLE ACTIVITY 
• Activity 
• Layout 
• Using Layouts from Activity 
• Activity to Activity Transition 
• Activity Lifecycle 
• Exercise 
2
Android Activities 
Activity 
Activity provides a user generally with an interactive screen to do something like: Dialing 
the phone, View a map List of something for user to select or Anything you want your user 
to do 
• An application usually consists of multiple activities. 
• Typically, one activity in an application is specified as the "main" activity, which is 
presented to the user when launching the application for the first time. (which is 
specified in AndroidMenifest.xml) 
The <action> element specifies that this is the "main" entry point to the application. 
The <category> element specifies that this activity should be listed in the system's 
application launcher (to allow users to launch this activity). 
3
Android Activities (Contd..) 
Creating Activity 
We have already created Activities. But how did we create it? 
Let’s revisit… 
1. We created subclass of Activity base class 
2. We implemented one callback method onCreate 
Open Questions: 
1. What is creating subclass??? 
2. What is callback methods??? 
4
ANDROID ACTIVITIES (CONTD..) 
Next Step: Implementing User Interface 
1. Design res/layout/yourlayout.xml 
2. Use Views from Activity class 
Next Step: Implementing User Interface 
<manifest ... > 
<application ... > 
<activity android:name=".ExampleActivity" /> 
... 
</application ... > 
... 
</manifest > 
Next Step: Starting Activity 
We can start another activity by calling startActivity(), passing it an Intent that describes 
the activity you want to start. 
Intent intent = new Intent(this, ToActivity.class); 
startActivity(intent); 
5
Android Activities Exercise 
1. We’ll make 2 Activities 
2. Registration with basic features and validation: 
1. Email address 
2. First Name, Last Name 
3. Date of Birth 
4. Password 
5. Confirm Password 
6. I agree to terms and conditions 
7. Buttons: Cancel, Submit 
3. Login 
1. Email address 
2. Password 
3. Buttons: New User, Login 
(To be added: Remember me) 
Link: http://developer.android.com/guide/appendix/faq/commontasks.html 
6
Android Activities Exercise (Contd.) 
1. How to add new Activities to the application 
2. How to navigate from one Activity to another 
How to navigate from one Activity to another 
Intent 
Activity 1 Activity 2 
Intent intent_1_to_2 = new Intent(this, Activity2.class); 
startActivity(intent_1_to_2); 
Intent 
Activity 1 Activity 2 
Intent intent_2_to_1 = new Intent(this, Activity1.class); 
startActivity(intent_2_to_1); 
7
Android Activities Exercise (Contd.) 
How to navigate from one Activity to another 
Intent 
Activity 1 Activity 2 
Intent intent1to2 = new Intent(this, Activity2.class); 
startActivity(intent1to2); 
Activity 1 Activity 2 Intent 
Intent intent2to1 = new Intent(this, Activity1.class); 
startActivity(intent2to1); 
8
Activity Lifecycle 
9
Activity Lifecycle (Contd.) 
10
Shared Preferences for Persistence 
Android applications can store data in application preferences. 
In this tutorial, you learn how to store persistent application data with shared preferences. 
1. Preferences in Android are used to keep track of application and user preferences. 
2. In any application, there are default preferences that can accessed through the 
PreferenceManager instance and its related method 
getDefaultSharedPreferences(Context) 
3. With the SharedPreference instance one can retrieve the int value of the any preference 
with the getInt(String key, int defVal). 
4. In our case, we can modify the SharedPreference instance in our case using the 
edit() and use the putInt(String key, int newVal) 
11
Shared Preferences for Persistence 
We see an example of this: 
1.We create a project: 
2.We also create a layout 
12
Shared Preferences for Persistence 
Here is our Activity 
13
Shared Preferences for Persistence 
We read and write now: 
14
Shared Preferences for 
Persistence 
Now we run the app: 
1. For testing we set a value 
2. Exit application 
3. Launch the app again 
4. Retrieve the value 
15
Thank You. 
16

Weitere ähnliche Inhalte

Was ist angesagt?

Create an android app for database creation using.pptx
Create an android app for database creation using.pptxCreate an android app for database creation using.pptx
Create an android app for database creation using.pptxvishal choudhary
 
Part 3 binding navigator vb.net
Part 3 binding navigator vb.netPart 3 binding navigator vb.net
Part 3 binding navigator vb.netGirija Muscut
 
Basic Fundamental of Redux
Basic Fundamental of ReduxBasic Fundamental of Redux
Basic Fundamental of ReduxInnovationM
 
E2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API InstructionE2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API InstructionE2D3.org
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIAhsanul Karim
 

Was ist angesagt? (11)

Hello Android
Hello AndroidHello Android
Hello Android
 
Create an android app for database creation using.pptx
Create an android app for database creation using.pptxCreate an android app for database creation using.pptx
Create an android app for database creation using.pptx
 
Part 3 binding navigator vb.net
Part 3 binding navigator vb.netPart 3 binding navigator vb.net
Part 3 binding navigator vb.net
 
Lab2-android
Lab2-androidLab2-android
Lab2-android
 
Basic Fundamental of Redux
Basic Fundamental of ReduxBasic Fundamental of Redux
Basic Fundamental of Redux
 
Android app
Android appAndroid app
Android app
 
E2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API InstructionE2D3 ver. 0.2 API Instruction
E2D3 ver. 0.2 API Instruction
 
Mobile application development: part 1: Andriod Vs IOS
Mobile application development: part 1: Andriod Vs IOS Mobile application development: part 1: Andriod Vs IOS
Mobile application development: part 1: Andriod Vs IOS
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts API
 
State pattern
State patternState pattern
State pattern
 
State Pattern in Flex
State Pattern in FlexState Pattern in Flex
State Pattern in Flex
 

Ähnlich wie Activity & Shared Preference

Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesAhsanul Karim
 
Multiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerMultiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerAhsanul Karim
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx34ShreyaChauhan
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Using intents in android
Using intents in androidUsing intents in android
Using intents in androidOum Saokosal
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database faiz324545
 
android_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semandroid_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semaswinbiju1652
 
Unit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxUnit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxShantanuDharekar
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)Oum Saokosal
 
Android App Development - 02 Activity and intent
Android App Development - 02 Activity and intentAndroid App Development - 02 Activity and intent
Android App Development - 02 Activity and intentDiego Grancini
 

Ähnlich wie Activity & Shared Preference (20)

Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through Activities
 
ANDROID
ANDROIDANDROID
ANDROID
 
Multiple Activity and Navigation Primer
Multiple Activity and Navigation PrimerMultiple Activity and Navigation Primer
Multiple Activity and Navigation Primer
 
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxxMAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
MAD Unit 5.pptxxxxxxxxxxxxxxxxxxxxxxxxxx
 
Android App development III
Android App development IIIAndroid App development III
Android App development III
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Using intents in android
Using intents in androidUsing intents in android
Using intents in android
 
Data Transfer between activities and Database
Data Transfer between activities and Database Data Transfer between activities and Database
Data Transfer between activities and Database
 
android_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last semandroid_mod_3.useful for bca students for their last sem
android_mod_3.useful for bca students for their last sem
 
Unit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxUnit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptx
 
QCRI Report
QCRI ReportQCRI Report
QCRI Report
 
Lab1-android
Lab1-androidLab1-android
Lab1-android
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)
 
Android App Development - 02 Activity and intent
Android App Development - 02 Activity and intentAndroid App Development - 02 Activity and intent
Android App Development - 02 Activity and intent
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Android intents in android application-chapter7
Android intents in android application-chapter7Android intents in android application-chapter7
Android intents in android application-chapter7
 

Mehr von nationalmobileapps (17)

Fragment
Fragment Fragment
Fragment
 
Android Location Api
Android Location ApiAndroid Location Api
Android Location Api
 
Play Store
Play StorePlay Store
Play Store
 
GCM (push notification)
GCM (push notification)GCM (push notification)
GCM (push notification)
 
Android Sensor
Android SensorAndroid Sensor
Android Sensor
 
Ad Mob
Ad MobAd Mob
Ad Mob
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
Google Map V2
Google Map V2Google Map V2
Google Map V2
 
Database
DatabaseDatabase
Database
 
Intent
IntentIntent
Intent
 
Support Multiple Screen
Support Multiple ScreenSupport Multiple Screen
Support Multiple Screen
 
Listview
ListviewListview
Listview
 
Android UI
Android UIAndroid UI
Android UI
 
Event Handling
Event HandlingEvent Handling
Event Handling
 
Project anatomy & hello world
Project anatomy & hello worldProject anatomy & hello world
Project anatomy & hello world
 
Mobile Application capacity building activities
Mobile Application capacity building activities Mobile Application capacity building activities
Mobile Application capacity building activities
 
Future of Smart phone in Bangladesh
Future of Smart phone in Bangladesh Future of Smart phone in Bangladesh
Future of Smart phone in Bangladesh
 

Kürzlich hochgeladen

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Kürzlich hochgeladen (20)

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

Activity & Shared Preference

  • 1. 1 Activities, Intents and Shared Preferences for Persistence
  • 2. SIMPLE ACTIVITY • Activity • Layout • Using Layouts from Activity • Activity to Activity Transition • Activity Lifecycle • Exercise 2
  • 3. Android Activities Activity Activity provides a user generally with an interactive screen to do something like: Dialing the phone, View a map List of something for user to select or Anything you want your user to do • An application usually consists of multiple activities. • Typically, one activity in an application is specified as the "main" activity, which is presented to the user when launching the application for the first time. (which is specified in AndroidMenifest.xml) The <action> element specifies that this is the "main" entry point to the application. The <category> element specifies that this activity should be listed in the system's application launcher (to allow users to launch this activity). 3
  • 4. Android Activities (Contd..) Creating Activity We have already created Activities. But how did we create it? Let’s revisit… 1. We created subclass of Activity base class 2. We implemented one callback method onCreate Open Questions: 1. What is creating subclass??? 2. What is callback methods??? 4
  • 5. ANDROID ACTIVITIES (CONTD..) Next Step: Implementing User Interface 1. Design res/layout/yourlayout.xml 2. Use Views from Activity class Next Step: Implementing User Interface <manifest ... > <application ... > <activity android:name=".ExampleActivity" /> ... </application ... > ... </manifest > Next Step: Starting Activity We can start another activity by calling startActivity(), passing it an Intent that describes the activity you want to start. Intent intent = new Intent(this, ToActivity.class); startActivity(intent); 5
  • 6. Android Activities Exercise 1. We’ll make 2 Activities 2. Registration with basic features and validation: 1. Email address 2. First Name, Last Name 3. Date of Birth 4. Password 5. Confirm Password 6. I agree to terms and conditions 7. Buttons: Cancel, Submit 3. Login 1. Email address 2. Password 3. Buttons: New User, Login (To be added: Remember me) Link: http://developer.android.com/guide/appendix/faq/commontasks.html 6
  • 7. Android Activities Exercise (Contd.) 1. How to add new Activities to the application 2. How to navigate from one Activity to another How to navigate from one Activity to another Intent Activity 1 Activity 2 Intent intent_1_to_2 = new Intent(this, Activity2.class); startActivity(intent_1_to_2); Intent Activity 1 Activity 2 Intent intent_2_to_1 = new Intent(this, Activity1.class); startActivity(intent_2_to_1); 7
  • 8. Android Activities Exercise (Contd.) How to navigate from one Activity to another Intent Activity 1 Activity 2 Intent intent1to2 = new Intent(this, Activity2.class); startActivity(intent1to2); Activity 1 Activity 2 Intent Intent intent2to1 = new Intent(this, Activity1.class); startActivity(intent2to1); 8
  • 11. Shared Preferences for Persistence Android applications can store data in application preferences. In this tutorial, you learn how to store persistent application data with shared preferences. 1. Preferences in Android are used to keep track of application and user preferences. 2. In any application, there are default preferences that can accessed through the PreferenceManager instance and its related method getDefaultSharedPreferences(Context) 3. With the SharedPreference instance one can retrieve the int value of the any preference with the getInt(String key, int defVal). 4. In our case, we can modify the SharedPreference instance in our case using the edit() and use the putInt(String key, int newVal) 11
  • 12. Shared Preferences for Persistence We see an example of this: 1.We create a project: 2.We also create a layout 12
  • 13. Shared Preferences for Persistence Here is our Activity 13
  • 14. Shared Preferences for Persistence We read and write now: 14
  • 15. Shared Preferences for Persistence Now we run the app: 1. For testing we set a value 2. Exit application 3. Launch the app again 4. Retrieve the value 15