private void save() { String name = mNameEditText.getText().toString(); AccountManager.Account account = getAccount(); account.setName(name); int categoryId = Application.getSortedCategoryIds()[mPosition]; account.setCategory(categoryId); if (mAccountId < 0) { AccountManager.getInstance().addAccount(categoryId, account); if (mListener != null) { mListener.onSave(categoryId); } } else { AccountManager.getInstance().setAccount(mAccountId, account); if (mListener != null) { mListener.onSaveChanged( mAccountId, categoryId, mOldCategoryId, name.equals(account.getAccountName())); } } getActivity().onBackPressed(); }