This shows you the differences between two versions of the page.
|
dapm:laboratoare:06 [2020/02/28 17:00] sabina.horincar |
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 76: | Line 76: | ||
| TODO: \\ | TODO: \\ | ||
| - In the constructor, Initialize SharedPreferences.\\ | - In the constructor, Initialize SharedPreferences.\\ | ||
| - | - In the save function, put the given String in the editor. Do not forget to commit\\ | + | - In the same function, put 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 | + | |