Top "Onbackpressed" questions

onBackPressed is a function called in the Android operating system when the user presses the back key.

How to implement onBackPressed() in Fragments?

Is there a way in which we can implement onBackPressed() in Android Fragment similar to the way in which we …

android android-fragments onbackpressed
Fragment PopBackStack

I am getting a strange problem, while using Fragments and popping back them out. I have one Fragment Activity: Step1: …

android android-fragments back-stack onbackpressed
How to go back and refresh the previous page in Flutter?

I have a home page which when clicked takes me to another page through navigates, do some operations in then …

flutter dart navigation back onbackpressed
Android Double Back Press to close the app having fragments

I followed this tutorial and certain similar answers on SO. My present onBackPressed code is as follows - private static …

android android-fragments onbackpressed
How do handle onBackPressed() in Fragment?

This is my class name public class PrimaryFragment extends Fragment implements OnRestartRequest { @Override public void onBackPressed() { if (mCardStackLayout.isCardSelected()) { mCardStackLayout.…

android android-fragments onbackpressed
How to finish Main Activity onBackPressed?

I am setting themes to my application. Themes are getting set well. I have two activities on is main activity …

java android android-activity activity-finish onbackpressed
In Android Navigation Architecture, how can I check if current Fragment is the last one?

I need to display custom AlertDialog, but only when there are no more fragments after calling NavController.navigateUp(). My current …

android kotlin android-alertdialog android-navigation onbackpressed
How to override onBackPressed() in Fragment

I want to use onBackPressed() in Fragment to back to its Activity when I click the back button, but I …

android fragment onbackpressed
Update selected state of navigation drawer after back press

Whats the proper way to handle the selected state of the navigation drawer after back press? I have a navigation …

android android-fragments navigation navigation-drawer onbackpressed
Android how to close a running app on back press?

How to exit from an app on back press of main activity? I am using this code, but its finish …

android onbackpressed