Questions tagged [onpause]

onPause is an Activity life-cycle event generated by the Android OS when an Activity is no longer the top-most one in the stack.

onPause is an Activity life-cycle event generated by the Android OS when an Activity is no longer the top-most one in the stack.

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

462 questions
3
votes
2 answers

activity life cycle Android

I have read several posts on here and elsewhere about the life cycle but I'm still confused. What do we store in the onpause, how do we store it and how do you recall it in the onresume Method. Any more info and if possible a detailed example would…
BrokenCodez
  • 53
  • 1
  • 8
3
votes
1 answer

Android Fragment onPause event called late with FragmentPagerAdapter

I have a FragmentPagerAdapter in an activity that manages 4 fragments, all is working fine, but the onPause, and onDestroyView events of each fragment, are not called immediatly after the new fragment is loaded ie : FragmentA --> FragmentB -->…
3
votes
5 answers

Is there an onPause for the entire application?

My application is a set of Activities and I have not subclassed Application. There is a static singleton class that runs a recurring timer (java.util.Timer). That timer needs to be paused when the user leaves my application. If there were only one…
Andreas
  • 7,470
  • 10
  • 51
  • 73
3
votes
2 answers

android:clearTaskOnLaunch doesn't work How to clear the backstack when comes to foreground?

I need this behavior in my app, "user must have to login in each time he tries to launch it(touching the app icon directly, or by task manager or via recent apps)" So the activities are in this order (think the App name is Foo app) S - Splash…
Randika Vishman
  • 7,983
  • 3
  • 57
  • 80
3
votes
4 answers

MediaPlayer loops when started from onPause()

I want to play a sound when onPause() of my Activity is called. To do so, I use the following code: @Override public void onPause() { super.onPause(); MediaPlayer player = MediaPlayer.create(this, Settings.System.DEFAULT_RINGTONE_URI); …
Baz
  • 36,440
  • 11
  • 68
  • 94
3
votes
6 answers

system("pause") clarification

When i use system("pause"), then a line "Press any key to continue..." shows up on the screen. This is iritating and makes reading the output quite cumbersome. Is there some way to stop this from coming?
IcyFlame
  • 5,059
  • 21
  • 50
  • 74
3
votes
2 answers

How to save state in Android onPause using android HttpRequest

My understanding of the Android lifecycle model is that when onPause() is called I should save any state that needs to be saved, because my app could be terminated at any point after I return. I'm targeting Gingerbread, so onStop might never be…
Michael
  • 9,060
  • 14
  • 61
  • 123
3
votes
1 answer

RoboSpice - getting started not working

I managed to implement sample of robospice (GoogleHttpClientSpiceService) and it works - it successfully goes to server, gets data and stores it in cache. Even displays toast and updates GUI if Activity is not onPause. My problem (and only reason I…
3
votes
4 answers

How to cancel the onPause or the onStop method?

EDITED & SOVLED (below) I need to make a kind of last-check when the user is leaving the Activity. If the result of this check is unsuccess, I need to not allow him to go out. I need a kind of this: @Override protected void onPause() { if…
Esinor I.D.
  • 73
  • 2
  • 5
3
votes
1 answer

Cocos2D pauseAllRunningActions?

I am having a hard time resuming animations in my Cocos2D app. I add a CCSprite as a child to a CCSpriteBatchNode and it goes off on an animation. So when I click the pause button I do this: [[[CCDirector sharedDirector] actionManager]…
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
3
votes
5 answers

using onResume and onPause

Suppose I have two activities, activity1 and activity2. I want to navigate from activity1 to activity2, get some info from activity2 and insert back it to activity1 and also I don't want to lose activity1 previous state as I left. how can I save its…
Obtice
  • 1,205
  • 3
  • 18
  • 44
3
votes
2 answers

Why override Activity.onDestroy() if it isn't reliably called?

I'm confused why anyone would ever override Activity.onDestroy() instead of onPause() if according to the documentation: There are situations where the system will simply kill the activity's hosting process without calling this method (or any…
Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
3
votes
2 answers

startActivity on foreground application causes onPause/onResume

I have a service running and listening on a socket. This service will start an activity to display a video frame when it receives a "format" message over the socket each video frame is then sent in succession. Body of MyService: (simplified and…
Zoccadoum
  • 862
  • 1
  • 10
  • 16
3
votes
2 answers

Activity onPause weird action

I have an onPause in my activity. The weird thing is that in just that single activity (a videoPlayer) onPause gets called twice Scenario: This happens in my video player on phone devices but not tablets. Press Power Button to go to standby, onpause…
Raigex
  • 1,205
  • 12
  • 32
2
votes
1 answer

Listview is empty after OnResume in android

In android , after lock and unlock the mobile, the activity get pause and resumed. On that time listview become empty.Pls help me to save values in onPause and retrieve that in onResume... Thanks in advance