File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
app/src/main/java/com/simplemobiletools/notes/activities Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
101
101
}
102
102
103
103
private void updateSelectedNote (int index ) {
104
+ saveText ();
104
105
mConfig .setCurrentNoteIndex (index );
105
106
mCurrentNote = mNotes .get (index );
106
107
mNotesView .setText (mCurrentNote .getValue ());
@@ -134,6 +135,7 @@ public void onClick(View v) {
134
135
} else if (mDb .doesTitleExist (title )) {
135
136
Utils .showToast (getApplicationContext (), R .string .title_taken );
136
137
} else {
138
+ saveText ();
137
139
final Note newNote = new Note (0 , title , "" );
138
140
final int id = mDb .insertNote (newNote );
139
141
newNote .setId (id );
@@ -205,6 +207,9 @@ public void onClick(DialogInterface dialog, int which) {
205
207
}
206
208
207
209
private void saveText () {
210
+ if (mCurrentNote == null )
211
+ return ;
212
+
208
213
final String newText = getCurrentNote ();
209
214
final String oldText = mCurrentNote .getValue ();
210
215
if (!newText .equals (oldText )) {
You can’t perform that action at this time.
0 commit comments