diff --git a/app/src/main/java/com/simplemobiletools/notes/Config.java b/app/src/main/java/com/simplemobiletools/notes/Config.java index 5b15452a..15ab6870 100644 --- a/app/src/main/java/com/simplemobiletools/notes/Config.java +++ b/app/src/main/java/com/simplemobiletools/notes/Config.java @@ -39,7 +39,7 @@ public class Config { } public int getCurrentNoteId() { - return mPrefs.getInt(Constants.CURRENT_NOTE_ID, 0); + return mPrefs.getInt(Constants.CURRENT_NOTE_ID, 1); } public void setCurrentNoteId(int id) { diff --git a/app/src/main/java/com/simplemobiletools/notes/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/notes/activities/MainActivity.java index d0243823..54129c30 100644 --- a/app/src/main/java/com/simplemobiletools/notes/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/notes/activities/MainActivity.java @@ -115,12 +115,12 @@ public class MainActivity extends SimpleActivity implements OpenNoteDialog.OpenN private void updateSelectedNote(int id) { saveText(); mCurrentNote = mDb.getNote(id); - if (mCurrentNote == null) - return; - - mConfig.setCurrentNoteId(id); - mNotesView.setText(mCurrentNote.getValue()); - mCurrNoteTitle.setText(mCurrentNote.getTitle()); + mNotes = mDb.getNotes(); + if (mCurrentNote != null) { + mConfig.setCurrentNoteId(id); + mNotesView.setText(mCurrentNote.getValue()); + mCurrNoteTitle.setText(mCurrentNote.getTitle()); + } mCurrNoteLabel.setVisibility(mNotes.size() <= 1 ? View.GONE : View.VISIBLE); mCurrNoteTitle.setVisibility(mNotes.size() <= 1 ? View.GONE : View.VISIBLE);