So I have a DialogFragment displaying Area selection list. Once user click on the area, the list refetch data to display Street selection list. At this point, I'd like to allow user to press hardware back button to return to Area selection. Is this possible? I tried to override a few methods below but I can only tap to the event but not stopping it from happening.
@Override
public void onCancel(DialogInterface dialog) {
if(isDismissable()){
super.onCancel(dialog);
}else {
Log.d(TAG, "Don't dismiss cancel this dialog!");
}
}
@Override
public void dismissAllowingStateLoss() {
if(isDismissable()){
super.dismissAllowingStateLoss();
}else {
Log.d(TAG, "Don't dismiss this dialog!");
}
}
@Override
public void dismiss() {
if(isDismissable()){
super.dismiss();
}else {
Log.d(TAG, "Don't dismiss this dialog!");
}
}
dismiss() get called when user press back button but even if I don't call super.dismiss(), dialog get dismissed regardless.
Is there a way to do this? I also look into how Google+ app is displaying ActionBar in the DialogFragment to provide HomeAsUp but I can't find any info on it.