I have 3 Activities
Activity1 >>Activity2 >>Activity3
In activity3 I'm finishing the activity and calling system.exit(0) to close my complete app
- should close background music
- close the activity
- destroy the appication
Condition is like this
- I've a timer in this activity3. On the OnFinish of the timer I should start activity2. I can't call NoHistory=true on activity2 because of the above condition
Any Help will be appreciated...
You have two Options, by you can exit the app, First you can close all the activities over HomeScreen.
Else you can implement a sub activity implementation, to implement so, you need to start each activity for result, and in event of exit app, do following:
In Subactivity:
and in onActivityResult check for result, if it has Action with Exit value, then set Result and finish that activity.
I think the following LINK will help you which is related to closing of app..
other then all above links provided in comments there is one more approach if you are using the BaseActivity concept ............
1- just keep a Boolean variable any where at global place in the applcaion like in Application class. boolean finishApp = true; (not keep this static)
2- either override the onRestart/onStart in BaseAcivity ( or in each activity :( ) as
3- on Button click just set finishApp true and finish current App.