views:

89

answers:

1

I have a service that is listening for some events.

When that event happens, it fires a screen by startActivity(intent)

When the user finishes doing something on that screen, the code calls finish()

but instead of 'closing' the complete application, is shows the main/launcher activity.

any way to go around this?

thanks

A: 

You can tell the main activity to finish() right before you call startActivity(). This way, when the screen activity ends, the application will have no running activities and so will exit.

Alteratively, you could use startActivityForResult() instead, and have the main activity call finish() when it is told that the screen activity has ended.

tlayton
He's calling the activity from a service so the correct way would be calling `stopSelf()` after the `startActivity()`
Macarse
both answers are wrong.Since its not called from another activity, I cannot call finish().And also stopSelf() stops the service, so that is not the solution.Thanks
Gonzalo Perr