onbackpressed Questions

2

Solved

I want to handle user back presses in one of the activity's (Java) fragments (Kotlin). In activity's onCreate method I call OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(t...
Wetterhorn asked 3/2, 2021 at 19:15

4

Solved

I have a simple HTML app with CSS and Javascript. I want to prevent the users from pressing the back button. I have achieved it using JavaScript and it works fine. My problem is that it doesn't wor...
Mossbunker asked 16/8, 2017 at 7:56

2

Solved

I am using Jetpack Compose and have a WebView wrapped in a AndroidView composable that looks like the following: AndroidView(modifier = modifier, factory = { context -> WebView(context).apply {...

8

Solved

I have a home page which when clicked takes me to another page through navigates, do some operations in then press the back button which takes me back to the home page. but the problem is the home ...
Inclination asked 14/4, 2018 at 10:43

1

Solved

Since the old Activity.onBackPressed() becomes deprecated starting Android 33, what is the better way to call it programmatically? Example: override fun onOptionsItemSelected(item: MenuItem): Boole...

2

Solved

How can I handle device back button's onPressed() in Flutter for Android? I know that I must put a back button manually for iOS but Android device has built-in BACK button and user can press it. Ho...
Cedar asked 16/2, 2019 at 7:0

58

Is there a way in which we can implement onBackPressed() in Android Fragment similar to the way in which we implement in Android Activity? As the Fragment lifecycle do not have onBackPressed(). Is...
Eastman asked 27/3, 2011 at 10:30

3

I have a Bottom Sheet Dialog Fragment which contains four Fragment with ViewPager. I want to call a method when onBackPressed clicked in Bottom Sheet Dialog Fragment. Implemented OnBackPressedCallb...
Donata asked 30/1, 2020 at 9:4

2

TLDR: I need a way to disable Android 10 gesture navigation programmatically so that they don't accidentally go back when they swipe from the sides The backstory: Android 10 introduced gesture nav...

4

Solved

I need to display custom AlertDialog, but only when there are no more fragments after calling NavController.navigateUp(). My current code does something similar, but there is a bug to it: override...

6

Solved

I followed this tutorial and certain similar answers on SO. My present onBackPressed code is as follows - private static final int TIME_DELAY = 2000; private static long back_pressed; @Override ...
Marilumarilyn asked 25/11, 2015 at 7:8

7

Whats the proper way to handle the selected state of the navigation drawer after back press? I have a navigation drawer with n entries (in a listview) like the SDK sample in Android Studio. When i...

1

I have nested fragment, fragment inside fragment. Using NavigationBottomView. Everything goes right when I backpress from parent to child fragment. But now, if I am inside child fragment and sudden...
Licketysplit asked 23/7, 2020 at 11:1

5

Solved

I have an AlertDialog and its setCancelable() is false. In Onbackpressed function I want the AlertDialog to be closed. But when setCancelable() is false, the back key doesn't work at all. What shou...
Vesicatory asked 29/2, 2020 at 6:59

1

Solved

I would like the onBackPressedDispatcher to absorb the back button press event. Sometimes but I don't see an option for it. Whats happening is that we are just today trying to upgrade to onBackPres...
Metry asked 7/9, 2019 at 21:13

4

Solved

I am using react native router flux in my react native app. I want to override the back button press event as I want to add confirmation popup before going back. I have searched a lot but all the l...

2

Solved

I am using navigation drawer in my app,I have fragments like F1,F2 and so on..and in every fragment I am parsing data and display in listview,everything is works fine if I go through my app like F1...

4

Solved

I have a Navigation drawer activity and many fragments that I reach via the nav drawer. In some of these fragments, I show a dialog which says "Loading.." while background tasks are happening. N...
Sidesman asked 30/9, 2015 at 10:17

1

I have been looking through several stackoverflow question to find out how can I listen to backpress button on a service using windows manager. Most of the answers proposes that it's not possible, ...
Lunna asked 15/3, 2017 at 22:2

4

Solved

For shared element transition I am following this github project. It has 2 screens - one with recyclerview having number of cards & second the detail screen. As expected, it exhibits shared ele...

1

Solved

Changing activities with an animation is possible using the code below: Bundle animation = ActivityOptions.makeCustomAnimation(App.getContext(), R.anim.enter_from_right, R.anim.exit_to_left).toBun...
Nicollenicolson asked 26/9, 2016 at 20:16

2

Solved

I have Two Activity one is InventoryActivity and Second is StoneDetailActivity. In my InventoryActivity have RecycleView In RecycleView Button Click I start the StoneDetailActivity using StartActiv...

1

Solved

I just started with this GMF example provided by Google. I would like to know How can I Exit Full Screen Video Mode by doing tap on back button, I tried using below code, but did not get any succe...
Connote asked 11/3, 2016 at 5:59

3

Solved

I have an app that downloads an image from Parse.com and displays that image in an Image View The problem is that whenever I exit the app (with the back button) and return the image is gone. How...

2

Solved

When using AutoCompleteTextView, the dropdown suggestion list appears with the software keyboard still visible. This makes sense, as it is often a lot more efficient to type ensuing characters to n...

© 2022 - 2024 — McMap. All rights reserved.