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
0
votes
1 answer

Android Expanding Toast cause crash

Hey I am getting an crash on the code below. I am trying to expand a Toast for a certan amount of time, and "kill" the Toast when the onPause is runned. What am I doing wrong? The crash occures when i add timer.cancel() in the onPause private…
Ukjent
  • 823
  • 2
  • 9
  • 26
0
votes
1 answer

How to Stop Service when onPause Method is called?

I have a service running in the background of an activity, now when the user presses the home button, onPause is called for the activity, what i want is to stop the service running in the background when onPause is called, but then i get an Error…
mb567
  • 691
  • 6
  • 21
0
votes
1 answer

pop up message from service provider(telecom network) causing activity to pause

I've found out that pop up messages from my service provider(telecom network) is causing my app activity to get paused.Is there any way i can prevent these from pausing my activity?
0
votes
1 answer

Android - Continue Music Playing onPause

I have a few audio files that play for a minute or two in an application, similar to a soundboard. When someone clicks a button, it plays the sound. Simple enough. I have a setting in a SharedPreference that asks a user if when they exit or pause…
-1
votes
2 answers

How to handle ToggleButton state in OnPause and OnResume state

I am facing problem with toggle button state on onResume() and onPause() state. Activity - A (first user toggle ON the button) then go back to Activity - B, then it will comeback to Activity - A then I want toggle Button is ON not OFF, how to handle…
-1
votes
1 answer

To get data from calendar in OnDestroy or OnPause

I have this code: namespace TestB { [Activity(Label = "TestB", MainLauncher = true, Icon = "@drawable/icon")] public class MainActivity : Activity { Java.Util.Calendar calendar; protected override void OnCreate(Bundle…
arz
  • 49
  • 1
  • 10
-1
votes
1 answer

How can I test my multiplayer game in the same computer?

The game created in unity but I cannot test the game. How can I open the game 10 times in the same computer? I also tried run in Background. But It works only with two players. I need to test more than with 8 players.
QWSA ZASZ
  • 25
  • 1
  • 7
-1
votes
3 answers

Do action if app paused for more than 5 minutes

I have an android app and I would like to be able to set it that if the app is minimized for less that 5 minutes it will resume normally but if for over 5 minutes will will be restarted like a banking app works. I can't find anything on this can be…
Errkal
  • 67
  • 1
  • 8
-1
votes
1 answer

Using onResume() and onPause() outside of MainActivity

I'm wondering if it's possible to use onResume() and onPause() outside the MainActivity. In my android project, I have the typical setup for my main class package com.my.package public class MainActivity extends AppCompatActivity { @Override …
newbie 14
  • 3
  • 2
-1
votes
6 answers

Is onPause() called when user closes the app from recents

I read a lot about activity lifecycle but I cannot find a simple answer. Let's assume someone is pressing Switch apps hardware button. When app is switched to a different app onPause() is guaranteed to be called. Also pressing Back (to close the…
koras
  • 1,107
  • 2
  • 13
  • 28
-1
votes
2 answers

Too much ram consumption when home button is pressed vs when back button is pressed

I am new to android development . I have an app which has background service, ArrayList of size 100. I am saving this ArrayList using SharedPreferences in onPause and onDestroy method. When I am in the app it consumes a lot of ram (60MB) and when I…
sandesh hegde
  • 34
  • 1
  • 12
-1
votes
3 answers

The App crashes when it goes in onPause?

I have 2 broadcastReceivers are registered from onResume when the toggle button is clicked. And in onPause i unregister them, but when I press the home button the App crashes an logcat generates the below errors. Code_Updated_2: @Override protected…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
-1
votes
1 answer

Problems continued to change. Android

I have a timer in my code. When the screen orientation is changed or when I leave the app with the back button, the timer does not retain the value. Is solved with onPause, onStop, onCreate methods .... but do not know exactly how. What solution…
-1
votes
1 answer

Toggle-button pause/resume current activity

I created a button, now i want that if I click on it, my app does a pause till I click again then it should resume at the same point. I've tried to use onPause() but it hasn't any effect for my app. @Override public void…
basti12354
  • 2,490
  • 4
  • 24
  • 43
-1
votes
1 answer

How to ensure SMS messages are processed by BroadcastReceiver even if device sleeps or my process is terminated?

[Revising my question per @CommonWare's feedback] I am trying to insert a record into a SQLite database for each SMS message the app receives from an external GPS transmitter (i.e., not from the phone's GPS). All SMS's are processed by my…
PeteH
  • 1,870
  • 25
  • 23
1 2 3
30
31