Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dapm:laboratoare:06 [2018/03/30 10:36]
ioana_maria.culic
dapm:laboratoare:06 [2021/04/20 10:03] (current)
ioana_maria.culic [Exercises :]
Line 1: Line 1:
-===== Laboratorul 06. =====+===== Lab 07 - Shared Preferences ​=====
  
 ====SharedPreferences==== ====SharedPreferences====
Line 54: Line 54:
 **Ex2** Create a class named MySharedPreference and add the code below:\\ **Ex2** Create a class named MySharedPreference and add the code below:\\
    ​public class MySharedPreference {    ​public class MySharedPreference {
-      ​MySharedPreference ​settings;+      ​SharedPreferences ​settings;
       SharedPreferences.Editor editor;       SharedPreferences.Editor editor;
       ​       ​
Line 75: Line 75:
 \\ \\
 TODO: \\ TODO: \\
-- In the constructor, ​Initializa ​SharedPreferences.\\ +- In the constructor, ​Initialize ​SharedPreferences.\\ 
-- In the save function ​and put the given String in the editor. Do not forget to commit\\ +- In the same functionput the given String in the editor. Do not forget to commit\\ 
-- In the getValue function take the string from the Shared ​preferencties ​and return it\\+- In the getValue function take the string from the Shared ​Preferences ​and return it\\
 - In the clearSharedPreferences function delete all values from preferences - In the clearSharedPreferences function delete all values from preferences
  
Line 87: Line 87:
 - When the Go To Second Activity Button is clicked, make an intent and start the next activity(second activity)\\ - When the Go To Second Activity Button is clicked, make an intent and start the next activity(second activity)\\
  
-**Ex5** In the SecondActivity java class, Initialize the MySharedPreference and set the value of the textview ​with the String from the sharedPreference.+**Ex5** In the SecondActivity java class, Initialize the MySharedPreference and set the value of the textView ​with the String from the sharedPreference.
 \\ \\
 RUN THE APP\\ RUN THE APP\\
-**Ex6** Change the default ​colors ​of the application. Add Background to the items from the XML file. +**Ex6** Change the default ​colours ​of the application. Add Background to the items from the XML file.\\ 
- +**Ex7** Send a primitive with the intent and show it in the second Activity (putExtra)\\
- +
-**BONUS**\\ +
-**B1** Send a primitive with the intent and show it in the second Activity (putExtra)\\ +
-**B2** https://​www.tutorialspoint.com/​android/​android_shared_preferences.htm+
dapm/laboratoare/06.1522395413.txt.gz · Last modified: 2018/03/30 10:36 by ioana_maria.culic
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0