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

Check if my app is launched from background or not in android?

Suppose if I am using my android app and I click on home button in say xyz activity. Now at this point the app is running in background, now if the app is launched again the xyz activity will be brought to front that is fine but I want to check if…
Syn3sthete
  • 4,151
  • 3
  • 23
  • 41
-1
votes
3 answers

Android activity.onPause() then activity.onResume() restarts the app

I can successfully call activity.onPause() to pause the application. But when i call activity.onResume() the application restarts. Is there a way to avoid this ? Edited I actually want to pause my application using a pause button
Dnu_12
  • 45
  • 1
  • 10
-2
votes
2 answers

How to save value of a string even after the activity/app is destroyed?

I have 2 int in my navigation drawer, the value of whom changes upon clicking different button on different locations in the app. I got the code to successfully increment and update them, but the problem is that they got reset when I open the app…
-2
votes
1 answer

Countdown timer still continues when onPause is called

I'm making a simple app where I start a countdown timer e.g. 25 to 0 and when the timer expires it shows a template.But when my mobile is locked timer will be paused and when i unlocked it will resume .what can i do for continues timer ?? public…
-2
votes
1 answer

How to keep a process running in background in onStop/onPause

I need to make a keep a command running in background even if the app is in background, but I didn't find any way. I'm kind new in android developing, So... public void RunAsRoot(String[] cmds) throws IOException { Process p =…
MoJo
  • 44
  • 7
-2
votes
2 answers

How to pause an activity on the emulator without stoping it

My question is almost similar to this question. In my app when I press the home button my app is stopped and not only paused. After reading the answers in the question (given in the link) I realized that onPause and onStop is indeed called after…
Sourav Kanta
  • 2,727
  • 1
  • 18
  • 29
-2
votes
2 answers

Android Adding music to MainActivity app crashes after exiting?

I am making an app in which I have a splash screen, and a menu page which has two buttons. I have added background music to the menu page. When I exit from the app the music doesn't stop. I tried onPause() and onStop() even onDestroy() methods but…
Ali Asheer
  • 117
  • 13
-3
votes
2 answers

Runnable, Pause and Resume thread

my app is working fine but i cant figure out why my void run(); still runs in the background when i click the "home" button. I want my thread to pause the Thread onPause and start the thread again when onResume() i called! Cant figure out what im…
Spoofy
  • 621
  • 4
  • 9
  • 27
-3
votes
2 answers

Stop taking pictures

My question is about a code that makes pictures every "x" seconds and save them in the SD card. I don't want to make pictures forever so there's a button in the app that it should stop making pictures. The thing is I have no idea how to make it…
ricriba
  • 11
  • 4
-3
votes
1 answer

saving int in onpause

public class excuse extends Activity{ String excuse[] = { "1", "2","3", "4", "5", "6","7","8", "9","10" }; Button re; Button pre; TextView dis; int counter; @Override protected void onCreate(Bundle savedInstanceState) { …
user3396986
  • 23
  • 1
  • 6
-4
votes
1 answer

LinkedHashSet not mainting order

Hi I am trying to allow the user to enter values which will be stored in a list. When the user exits that activity I want that list to be stored (IN THE SAME ORDER) to SharedPreferences and then once the user returns I want it to be displayed again…
Aaron
  • 47
  • 11
-5
votes
1 answer

How do I change the onPause method of an APK file?

I have an APK file that it requires on Internet connection. But when I click the Home button it loses its connection and can't use the Internet in onPause mode. How can I change the onPause method to do what I want in my application without losing…
1 2 3
30
31