@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.activity_category_edit); mNameText = (EditText) findViewById(R.id.category_edit_name); Button confirmButton = (Button) findViewById(R.id.category_edit_confirm); Bundle extras = getIntent().getExtras(); // check from the saved Instance taskUri = (bundle == null) ? null : (Uri) bundle.getParcelable(IssueTrackingContentProvider.CATEGORY_CONTENT_ITEM_TYPE); // or passed from other activity if (extras != null) { taskUri = extras.getParcelable(IssueTrackingContentProvider.CATEGORY_CONTENT_ITEM_TYPE); fillData(taskUri); } confirmButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (TextUtils.isEmpty(mNameText.getText().toString())) { makeToast(); } else { setResult(RESULT_OK); finish(); } } }); }
@Override protected void onPause() { super.onPause(); saveState(); }
protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); saveState(); outState.putParcelable(IssueTrackingContentProvider.CATEGORY_CONTENT_ITEM_TYPE, taskUri); }