protected void saveData() { String title = getTitleEditText().getText().toString(); String body = getBodyEditText().getText().toString(); if (getEntityId() == null) { long id = processor.createSubscription(title, body); if (id > 0) { setEntityId(id); } } else { processor.updateSubscription(getEntityId(), title, body); } }
protected void loadData() { if (getEntityId() != null) { Cursor sub = processor.fetchSubscription(getEntityId()); startManagingCursor(sub); getTitleEditText().setText(sub.getString(Subscription.COLUMN_INDEX_TITLE)); getBodyEditText().setText(sub.getString(Subscription.COLUMN_INDEX_BODY)); } else { setTitle(R.string.add_sub); } }
@Override protected void onCreate(Bundle savedInstanceState) { processor = new SubscriptionProcessor(this); preferences = Preferences.getPreferences(this); super.onCreate(savedInstanceState); if (preferences.isFirstLaunch() || processor.fetchAllSubscriptions().getCount() == 0) { Dialogs.showOkConfirmation(this, R.string.initial_setup, R.string.msg_create_sub, null); } }