Questions tagged [onresume]

onResume is an Activity life-cycle event generated by the Android OS when an Activity becomes the top-most one in the stack.

onResume is an Activity life-cycle event generated by the Android OS when an Activity becomes the top-most one in the stack.

More can be read about this at the Android Developer Site.

712 questions
15
votes
3 answers

Why is onResume method of a Fragment never fired after dismissing a DialogFragment which was launched from the Fragment?

I am going to explain my problem as short as possible. I have a Fragment called FragmentA which displays a DialogFragment after clicking on a specific button. public class FragmentA extends Fragment implements OnClickListener { ... …
14
votes
1 answer

Determine if Activity came to front due to back navigation

I'd like to know if my Activity was displayed because the user pressed back on some other Activity. In the Lifecycle I couldn't identify any Callbacks that are robustly giving me that info. onRestart() is not working. It will also fire if the Apps…
Jakob
  • 1,126
  • 3
  • 16
  • 38
13
votes
4 answers

Android onResume update list adapter

I'm using a list adapter to show different stores, when someone selects a store it takes them to a new activity where they can add the store to favorite on that screen. There is a Back button on that calls finish(); that goes back to the screen…
James Gu
  • 1,382
  • 4
  • 26
  • 39
13
votes
3 answers

Stop fragment from being recreated after resume?

I am using several fragments to be dynamically added into activity. Everything works fine, when I press back-button, the fragments go to backstack. And when I resume it, it appears. But everytime on Resume, it is recreating the fragment and call…
Kaidul
  • 15,409
  • 15
  • 81
  • 150
12
votes
1 answer

Determine Reason for Android Pause

My application is randomly pausing (going into the onPause method) then resuming (going into the onResume method) when I'm not even touching the screen. In logcat, there is no indication what is causing the pause and resume. This only happens on a…
Amandeep Grewal
  • 1,801
  • 3
  • 19
  • 30
12
votes
1 answer

Canvas draw functions not working after screen locked and unlocked

I'm working on an augmented reality application in which I have a camera preview screen on which I draw some markers which moves with respect to device movement. When I lock and unlock the device, the markers freezes and doesn't move further. I'm…
Jas
  • 3,207
  • 2
  • 15
  • 45
11
votes
1 answer

Android - Prevent onResume() function if Activity is loaded for the first time (without using SharedPreferences)

In my current application the onResume function is triggered when I load an Activity for the first time . I looked into the Activity Lifecycle, but I didn't find a way to prevent this from happening. Can I prevent the onResume() function from…
11
votes
5 answers

Android back button behaviour

Let's say we have a default, empty activity with default behaviour, launched with default intent flags. User presses back button on the device. The activity disappear... but how, actually? Is pressing back button behaving the same way like…
Sebastian Nowak
  • 5,607
  • 8
  • 67
  • 107
10
votes
3 answers

Get onPause & onResume like events at application/task level

I was wondering what could be the reason for not having a callback at the application level when an application goes to background and comes to the foreground. Activity class's onPause and onResume are only called on the current top activity. If I…
Ron
  • 24,175
  • 8
  • 56
  • 97
10
votes
1 answer

didChangeAppLifecycleState doesn't work as expected

I hope I understand how didChangeAppLifecycleState worked correctly. I have page A and page B . When I click the back device button from page B ( Navigator.of(context).pop(); ), I expect didChangeAppLifecycleState in pageA will get called, but it…
Tony
  • 2,515
  • 14
  • 38
  • 71
10
votes
3 answers

Crash when resuming Activity due to NPE

I've observed some crashes among the users of my app which is related to a configuration change and the Activity being recreated, I was not able to reproduce it. The issue seems to be inside the Android classes and therefore there's no chance for me…
devgianlu
  • 1,547
  • 13
  • 25
10
votes
7 answers

Alternative to direct onResume() call

I am rewriting my Android app to eliminate direct calls to onResume(). My app currently does most of its work inside onResume() it then posts the display and that is the end of onResume(). @Override public void onResume() { super.onResume(); …
user1644002
  • 3,211
  • 3
  • 19
  • 21
10
votes
4 answers

Calling onResume method after an alert is dismissed in Android?

I want to know if when the user presses "Yes" on an alert dialog and this one is dismissed, that event executes the onResume method of the activity in which the user is in. Because I have a "Clean" button that asks the user if he's really sure of…
alois.wirkes
  • 369
  • 2
  • 7
  • 20
9
votes
3 answers

onRestart() being called when back button hit, any way to prevent this?

My application calls a few web services when it is freshly launched. I would also like to call these web services if the user launches the app (which was running in the background) and resumes. I've looked into all the methods fired when apps are…
PaulG
  • 6,920
  • 12
  • 54
  • 98
9
votes
1 answer

UDP listening socket stops listening after network configuration changes

I have a UDP socket listening in a port for broadcast transmissions and it is working fine. However, when I hibernate and resume the OS (Windows 7), the socket just stops receving data (and I can see that there is data arriving using Wireshark).…
Vargas
  • 2,125
  • 2
  • 33
  • 53
1
2
3
47 48