Return to previous activity using onBackPressed() without finish()?
Tag : android , By : Priyatna Harun
Date : March 29 2020, 07:55 AM
I wish this helpful for you Just call super.onBackPressed () just after your Animation code finishes. No need to do anything else...
|
Activity won't finish onbackpressed
Tag : android , By : Luciano Campos
Date : March 29 2020, 07:55 AM
around this issue @KaranMer helped me solve this. I had two intents (one in try and the other in finallyand I just had to get rid of one.
|
How to finish() an activity with SoftKeyboard visible with onBackPressed()
Date : March 29 2020, 07:55 AM
This might help you So after trying many things, here something that worked : Subclass EditText and override the onKeyPreIme() function to send a call back. Here's the code for the subclass : OnKeyPreImeListener onKeyPreImeListener;
public void setOnKeyPreImeListener(OnKeyPreImeListener onKeyPreImeListener) {
this.onKeyPreImeListener = onKeyPreImeListener;
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
if(onKeyPreImeListener != null)
onKeyPreImeListener.onBackPressed();
Log.d(TAG, "HIDING KEYBOARD");
return false;
}
return super.dispatchKeyEvent(event);
}
public interface OnKeyPreImeListener {
void onBackPressed();
}
EditTextGraphee.OnKeyPreImeListener onKeyPreImeListener =
new EditTextGraphee.OnKeyPreImeListener() {
@Override
public void onBackPressed() {
Log.d(TAG, "CALL BACK RECEIVED");
MyActivity.this.onBackPressed();
}
};
editText.setOnKeyPreImeListener(onKeyPreImeListener);
|
How to finish Main Activity onBackPressed?
Tag : java , By : cheese_doodle
Date : March 29 2020, 07:55 AM
Any of those help Just finish Settings Activity when on back pressed in Settings Activity. So it will go to Main Activity. So put below code in override method onBackPressed. @Override
public void onBackPressed() {
super.onBackPressed();
Intent i=new Intent(this,MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
finish();
}
|
Why Activity is not finishing or destroying after calling finish() in onBackPressed()?
Date : March 29 2020, 07:55 AM
|