-1

I Have an android application in which I handled the device Home button click.I made the application relaunched automatically when user clicks on Home button while my application is running using Service. When user clicks on Home button while running my application , shows default home screen and then shows again the activity. But my problem is that is takes some long time to show last activity of my application from home screen.ie,the home screen is displayed for a long time.Because of this user can launch any other application from home screen and my application runs in background.ie,When pressing BACk button after launching another application it is possible to view my application. Is it possible to avoid this delay and bring my application to front of that launched app?

Thanks in Advance

Devu Soman
  • 2,246
  • 13
  • 36
  • 57

2 Answers2

0

Place the Home button Code in your AsyncTask doinBackground() or you can use Handler. That would help you in reducing the delay of loading the activity. For more information on How to use AsyncTask and Handler, check this link: Android Background Processing

Avadhani Y
  • 7,566
  • 19
  • 63
  • 90
0

I implement a countdown timer in my service that repeatedly start my activity in onStick. When my activity comes to the foreground, in onNewIntent I send a message to the service to cancel the countdown timer. It works out pretty well.

Hoan Nguyen
  • 18,033
  • 3
  • 50
  • 54