March 2018
Intermediate to advanced
500 pages
12h 40m
English
SharedPreferences is an interface for storing, accessing, and modifying data. The SharedPreferences APIs enable data storage in sets of key-value pairs.
We will set up a simple utility to handle our data storage needs for this app utilizing the SharedPreferences interface. Create a package in the project's source directory with the name storage (right-click the source directory and select New | Package):

Next, create a new Kotlin class named AppPreferences within the storage package. Type the following code into the class file:
package com.mydomain.tetris.storageimport android.content.Contextimport android.content.SharedPreferences ...
Read now
Unlock full access