Detect a hardware back button pressed On Android #1760
Replies: 4 comments
-
Does the use of the hardware back button call Close on the popup? |
Beta Was this translation helpful? Give feedback.
-
Can you try to override the method backbutton pressed inside the Page and see if that works for you? |
Beta Was this translation helpful? Give feedback.
-
Closed as answered, if closed in error please let us know to re-open. |
Beta Was this translation helpful? Give feedback.
-
@mchiz would you mind sharing what answer worked for you? I can't get this to work. Also, why doesn't the popup conform to any of the existing Xamarin/MAUI pages? Why make it so different? RG Popup extension on Xamarin went to the effort of keeping it consistent with the popup stack, and the usability was the same as pushing and popping navigation pages and modals. It also had methods like The new toolkit Popups are making migrating from Xamarin to MAUI quite difficult due to the significant behavioural differences between it and standard |
Beta Was this translation helpful? Give feedback.
-
Hi! I use some popups to display the progress of a cancellable long operation. I would like to show a confirmation dialog when the user presses the hardware back button instead of closing the popup.
I know I can avoid closing the popup with the 'CanBeDismissedByTappingOutsideOfPopup' flag, but I can't catch the hardware back button press.
I'm trying to create a workaround using AndroidX.Activity.OnBackPressedCallback on Android, but I can't get it to work. If I could, it would not be pretty.
I would like to be able to override the closing of a Popup, the same way I can override the method OnBackButtonPressed on Pages and show a confirmation dialog or whatever.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions