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
5
votes
3 answers

onSaveInstanceState() and onPause() call sequence

The documentation on onSaveInstanceState() states: If the method is called, it is always called before onStop() and possibly before onPause(). But, I notice, consistently, from log messages that onPause() is ALWAYS CALLED BEFORE…
lupchiazoem
  • 8,026
  • 6
  • 36
  • 42
5
votes
2 answers

startActivity in onPause() not working after opening new app

I Start a second activity when my first activity is paused. FirstActivity.java @Override public void onPause(){ super.onPause(); startActivity(new Intent(this, SecondActivity.class)); } When I press on the homescreen button, SecondActivity…
5
votes
0 answers

What is activity idle and why is it called after app start?

I am working on a camera app using Camera API and after I start my app, in about 3 seconds, my activity goes idle(this is my logcat when activity starts): 18317-18317/com.example.cristi.appname W/Preview﹕…
Chris
  • 6,105
  • 6
  • 38
  • 55
5
votes
1 answer

android - There is no default constructor for ArrayAdapter

I m making adapter to adapt my book collection to be visible in list view. Issue is solved if I add super(context, position): public BookAdapter(Context context, int position, List updatedBooksList) { super(context, position); …
ERJAN
  • 23,696
  • 23
  • 72
  • 146
5
votes
2 answers

Guaranteed alternative to onDestroy()?

I'm trying to execute some code whenever my activity is killed, but not when it's simply moved to the background (so just calling it in onPause() isn't a solution), and I understand onDestory() is not guaranteed to be called. I've been searching all…
Drazen Bjelovuk
  • 5,201
  • 5
  • 37
  • 64
5
votes
2 answers

Android - execute code onResume and onPause for all the activities of the app?

I'm designing an architecture where the app needs to execute certain set of operations everytime it goes to background (onPause) and a set of operations everytime it comes back to foreground (onResume), irrespective of the activity (for all the…
Ocelot
  • 1,733
  • 4
  • 29
  • 53
5
votes
2 answers

Libgdx: Pause menu and Pause state

I have a question regarding the pausing/freezing a game while a window/pausemenu will appear at center of the screen. I've already created a pausescreen class which will be called each time the back key is being pressed. My problem is that I don't…
Essa Rebaño
  • 113
  • 1
  • 3
  • 11
5
votes
1 answer

AdMob - Disable request onPause()

I have read few articles on trying to stop adView when the app is hidden/minimised but this crashes my app. This is my code, adView.LoadAd... and adView.stopLoading both crashes the app on startup. public class MainActivity extends Activity…
KickAss
  • 4,210
  • 8
  • 33
  • 41
4
votes
1 answer

MyLocationOverlay disableMyLocation() not seeming to work

Just wasted 3 hours trying to figure out why the GPS icon is still showing up in the notification bar when my map activity is paused. I've narrowed it down to having to do with the MyLocationOverlay object I'm using (I also have a LocationListener…
NSjonas
  • 10,693
  • 9
  • 66
  • 92
4
votes
2 answers

How to detect OnResume and onPause on react native Es6

How can I detect any method from background to foreground es6? Is this possible in React-native? and is there any class or tool that could help with this type of method?
Pankaj Gadhiya
  • 111
  • 1
  • 9
4
votes
1 answer

Resuming MediaPlayer from the last location in onResume

I am creating a video player. I have implemented onPause method for getting last position of mediaplayer when home button is pressed and in onResume I am setting that location to mediaplayer and calling start. My question is that when I run the…
4
votes
1 answer

How to stop Service when app is paused or destroyed but not when it switches to a new Activity?

Currently I have a Service which I am using to play a sound file in the background whilst the app is open: public class BackgroundSoundService extends Service { MediaPlayer player; public IBinder onBind(Intent arg0) { return null; …
4
votes
3 answers

Running code in onPause() or onStop() state of the activity

There is a function in my android app that needs to run every time the user tries to edit his or her profile. There are two parts of edit profile in my app (please don't ask why, it has a very long tedious reason behind it). I need to revert back…
matlab hater
  • 163
  • 3
  • 12
4
votes
2 answers

Pausing timer without destroy and re-create - Android

I have this AsyncTask, that sleeps 0.1 second each time that executes "doInBackground", before that I was using a CountDownTimer to control my time. My problem is: I want to achieve a timer that can Pause without calling .cancel() and when starts…
guisantogui
  • 4,017
  • 9
  • 49
  • 93
4
votes
0 answers

onPause() method issue on kitkat 4.4

My app contain lock screen which will be come up when app brought from background. I am facing a problem particularly onwards kitkat 4.4. While app goes in background, i am checking that the Is application going in background? in onPause() method of…
Rohan Patel
  • 1,758
  • 2
  • 21
  • 38
1 2
3
30 31