@Override public void onClick(View v) { if (isUpdate) { isUpdate = false; final MyRemDialog dialog = new MyRemDialog(HomePageActivity.this, R.style.dialog); dialog.setTitle(R.string.user_basic_dialog_save_rem_title); dialog.setMessage(R.string.user_basic_dialog_to_save_message); dialog.setPosBtnText(R.string.user_basic_dialog_save_rem_btn_save); dialog.setNegBtnText(R.string.user_basic_dialog_save_rem_btn_cancel); dialog.setPosBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { isUpdate = false; btnRight.setImageResource(R.drawable.edit_btn_selector); afterToUpdateUserInfo(); } }); dialog.setNegBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } else { finish(); } }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK && isUpdate) { final MyRemDialog dialog = new MyRemDialog(HomePageActivity.this, R.style.dialog); dialog.setTitle(R.string.user_basic_dialog_save_rem_title); dialog.setMessage(R.string.user_basic_dialog_to_save_message); dialog.setPosBtnText(R.string.user_basic_dialog_save_rem_btn_save); dialog.setNegBtnText(R.string.user_basic_dialog_save_rem_btn_cancel); dialog.setPosBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { isUpdate = false; btnRight.setImageResource(R.drawable.edit_btn_selector); afterToUpdateUserInfo(); } }); dialog.setNegBtnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } // else { // HomePageActivity.this.finish(); // } return super.onKeyDown(keyCode, event); }