[Android] How to prevent the background from turning on again

Asked 2 years ago, Updated 2 years ago, 124 views

I'm making a simple application with Android. With an application that returns to the background It is an application that repeats raising the number 1 after 10 seconds, changes the textview to that value, and turns off when it reaches 160.

I used timer and timerTask After you start the app, press the home button to return to the background After 10 seconds, the number 1 increases and the application displayed in textview turns on again.

I want to make sure that it doesn't turn on again I don't know what to do. It's my first time in the background, so I don't think I have a clue.

Please give us some advice.

android background timer

2022-09-20 16:25

1 Answers

You have to upload the code of the part that runs every 10 seconds in the timerTask to make a definite decision. Just because you implemented it through timerTask doesn't mean that the app will come back to the front.


2022-09-20 16:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.