private void saveUserLocally() { AppUser newAppUser = new AppUser( mYourFullNameEdit.getText().toString(), mYourEmailAddressEdit.getText().toString(), mYourPasswordEdit.getText().toString(), getCompressedDOB(), "United Kingdom"); newAppUser = mCycleDatabase.addAppUser(newAppUser); UserSettings newUserSettings = new UserSettings( newAppUser.getmAppUserId(), mFertilityTestingToggle.isChecked(), mPregnancyTestingToggle.isChecked(), mRemindersToggle.isChecked(), Integer.parseInt(mAvgCycleLength.getText().toString()), Integer.parseInt(mAvgPeriodLengthEdit.getText().toString()), 14, Integer.parseInt(mAvgCycleLength.getText().toString()), 14, 13, mCloudBackupToggle.isChecked()); newUserSettings = mCycleDatabase.addUserSettings(newUserSettings); UserData.mCurrentUser = newAppUser; UserData.mCurrentUserSettings = newUserSettings; mCycleDatabase.updateRememberedUserId(0); Intent i = new Intent(SignupActivity.this, CalendarMonthsActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); }
@Override public void onStop() { super.onStop(); mCycleDatabase.close(); }