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

Can we execute code after startActivity() before it gets paused?

My question is... If we try to execute some code after startActivity() will it we fully executed before the onPause() of the current Activity is called? That is, I do not know if startActivity() will actually be called when the method that contains…
Caumons
  • 9,341
  • 14
  • 68
  • 82
2
votes
3 answers

How to tell if the user has finally quit all your activities in android application

I want to set ringvolume to 0 when a user opens my teaching application then return it to the original volume when the user quits. What's the best way of doing this? I can set volume to 0 with no problems The difficulty is knowing when to restore…
jason
  • 427
  • 5
  • 20
2
votes
3 answers

onPause gets called before leaving the current activity

I have the following: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); .... populate(); handler = new Handler(); t = new Timer(); …
adrian
  • 4,574
  • 17
  • 68
  • 119
2
votes
1 answer

is an Activities onPause method called when the screen times out?

I'm having trouble understanding the screen timeout function and how that will effect code running in my activities. Does onPause() get called when the screen times out? I have an activity and a related service running an AsyncTask, which is…
Sam Clewlow
  • 4,293
  • 26
  • 36
2
votes
4 answers

Pause in android

I have developed a game in which i need a pause in any single button click event. I am confused because I have use swf file and sound and much resource. As shown, when you pause the screen it will goto sleep mode and the resume button is in front…
Nikunj Patel
  • 21,853
  • 23
  • 89
  • 133
2
votes
2 answers

What is better for my needs, onPause() or onSaveInstanceState()?

i have an app that has three pages, one of them is the main page. the user can enter in a few fields that i would like to save if the user goes to one of the two sub pages. i have been looking into the onPause() and into onSaveInstanceState(). i…
zach
  • 1,281
  • 7
  • 27
  • 41
2
votes
0 answers

What happens when Activity is paused while it's waiting for data from the Internet?

What happens if an ActivityA makes a Volley request (ASAIK, Volley request runs not on the UI Thread), and let's say that the volley request ask for a lot of data. Volley request has a callback method named onResponse, that contains the JSON…
Eitanos30
  • 1,331
  • 11
  • 19
2
votes
1 answer

How to create a function sleep(miliseconds) in a google sheet to delay or pause a formula in a range

In a google sheet I have: Range B1:B260 I have the Function: (ImportXML(A1;"//a/@href") (ImportXML(A2;"//a/@href") (ImportXML(A3;"//a/@href") . . . (ImportXML(A260;"//a/@href") I Need to delay the time between the calculation because If I perform…
2
votes
1 answer

After Android onResume ListView is empty

I have a ListView which onResume I am trying to populate with data from a SQL Lite Database. During resume I add a click listener and repopulate the List View. The onResume, populateListView(), and onPause methods are below. The full source code is…
ahsteele
  • 26,243
  • 28
  • 134
  • 248
2
votes
1 answer

Determine the reason why onPause was invoked

I'm creating an app in which I need to make a certain action if the application was paused because the screen was turned off on its own due to lack of activity of the user with the device, and another action if the user had moved the application to…
CodeMonkey
  • 11,196
  • 30
  • 112
  • 203
2
votes
0 answers

Handling OnPause and OnResume inside fragments android

I am trying to communicate with USB using InputOutput stream, I use constructor and make the communication part in a common class and I do use it inside a fragment, if i use it inside an activity it works properly if i use inside a fragment, the…
2
votes
1 answer

Android onResume() not being called when returning to an Activity

onResume runs at startup as per the app lifecycle, but not when the activity is returned to after pausing: Where is meant to call onResume at this stage? the onResume being overriden does not run by itself either.
Gavin
  • 2,214
  • 2
  • 18
  • 26
2
votes
3 answers

Cordova Android how to stop audio on pause?

a colleague of me made a crossplattform game app with Cordova. now he is in vacation and I have the problem, that the background music of the app is still playing, if you press the home button and leave the app. Also if you make a phone call. I…
DeeFour
  • 436
  • 5
  • 17
2
votes
2 answers

Android App Crashes when paused

I have an android activity which displays a live camera preview using a surfaceview. Everything works fine, however when I press the lock button on my phone and then unlock my phone or when a dialog box from another activity (example bluetooth…
Alk
  • 5,215
  • 8
  • 47
  • 116
2
votes
2 answers

Android: equivelent of IOS' "applicationDidEnterBackground()"

I am working on an app and in the IOS version whenever an external event happens such as the home button or a call comes in the app shows its password entry screen as it shows sensitive data. I am trying to replicate this in android, I am having…
berimbolo
  • 3,319
  • 8
  • 43
  • 78