Skip to content

Commit 3072a24

Browse files
committed
Saving persistent data items
1 parent 4e575d5 commit 3072a24

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/src/main/java/com/appleobject/notekeeper/MainActivity.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,16 @@ class MainActivity : AppCompatActivity() {
8484
invalidateOptionsMenu()
8585
return true
8686
}
87+
88+
override fun onPause() {
89+
super.onPause()
90+
saveNote()
91+
}
92+
93+
private fun saveNote() {
94+
val note = DataManager.notes[notePosition]
95+
note.title = textNoteTitle.text.toString()
96+
note.text = textNoteText.text.toString()
97+
note.course = spinnerCourses.selectedItem as CourseInfo
98+
}
8799
}

0 commit comments

Comments
 (0)