Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

trigger android hardware back button in code

$
0
0

I have my own back button and maintain a navigation stack. If I pass back through that stack and the user taps my back button again, I want to trigger the hardware back button press - Finish the activity. From within my ContentPage I tried to call OnBackButtonPressed(), but it just returns false. Should this work? Is there a better way to trigger a button press?

    private async void BackTappedCallback(object o)
    {
        if (App.Navigation.NavigationStack.Count > 1)
            await App.Navigation.PopAsync();
        var onBackButtonPressed = OnBackButtonPressed();
    }

Thanks!


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>