Skip to content

Instantly share code, notes, and snippets.

@codingwithsara
Created March 8, 2019 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingwithsara/004a2da12a498335342a8f0876f62091 to your computer and use it in GitHub Desktop.
Save codingwithsara/004a2da12a498335342a8f0876f62091 to your computer and use it in GitHub Desktop.
Kotlin - SharedPreferences
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical"
android:gravity="center_horizontal">
<EditText
android:id="@+id/editName"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:hint="Name"
android:layout_marginTop="80dp"/>
<EditText
android:id="@+id/editEmail"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="Email"
android:layout_marginTop="20dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
android:layout_marginTop="20dp"
android:onClick="saveData"/>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment