public void saveBuddyAlert(View view) { if (isValid()) { p = getInputData(); Log.i(Constants.TAG_PERSON, p.toString()); InfoDialogFragment dialog = new InfoDialogFragment(); if (isEditSession) dialog.setDialogTitle(getResources().getString(R.string.info_dialog_title_edit_buddy)); else dialog.setDialogTitle(getResources().getString(R.string.info_dialog_title_new_buddy)); dialog.show(getFragmentManager(), ""); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); // v7 action bar prevents nullpointer actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_register_message); messageText = (EditText) findViewById(R.id.addmessageGreetingsText); isActiveSwitch = (Switch) findViewById(R.id.addmessageSwitchIsActivate); isActiveSwitch.setChecked(true); Intent intent = getIntent(); person = (Person) intent.getSerializableExtra(Constants.TAG_PERSON); // Sets up name and birthdaydate of the newly added buddy i this activity header buddyName = (TextView) findViewById(R.id.addmessageHeaderText); buddyBDay = (TextView) findViewById(R.id.addmessageBirthdayDateText); buddyName.setText(person.getName()); buddyBDay.setText(person.getSimpleYearMonthDay()); // If we are editing an existing person we can populate all the textboxes isEditSession = intent.getBooleanExtra(Constants.IS_EDIT_SESSION, false); if (isEditSession) { messageText.setText(person.getBirthdayMessage()); isActiveSwitch.setChecked(person.isActive()); } Log.i(Constants.TAG_PERSON, person.toString()); db = new DBHandler(this); }