0

When the user taps the back button, an activity(whith has the dialog theme) is started. this activity has two buttons : ok, cancel

How to finish all the activities when the user hits "ok" ?

  • http://stackoverflow.com/questions/14001963/finish-all-activities-at-a-time – Alexis C. Jun 12 '13 at 17:28
  • 3
    There have been so many questions about this on here. Why do people insist on bothering the user by asking if they want to close the app unless absolutely necessary? Yes I want to close it, that's why I hit the back button – codeMagic Jun 12 '13 at 17:29
  • 2
    @codeMagic what you're saying is the easy way to go.. practically the majority of apps offer confirmation to the user –  Jun 12 '13 at 17:32
  • 1
    @codeMagic Sometimes it's useful to have such a functionnality (for example if you try to exit an app without saving what you've done). – Alexis C. Jun 12 '13 at 17:34
  • "... practically the majority of apps offer confirmation to the user" not apps I use – codeMagic Jun 12 '13 at 17:34
  • @ZouZou I'm not saying that its never a good idea but, IMHO and I think many would agree, if its not necessary then it is a bother to the users. – codeMagic Jun 12 '13 at 17:35
  • ah ok.. so it is your opinion and YOUR apps.. you should play more games to know what am talking about –  Jun 12 '13 at 17:37
  • 2
    @ZouZou This is a mobile environment. Only save data when the app exits? Are you kidding us? I despise apps that ask. Its (nearly always) bad design and bad thinking. I only have one, that I have to use, and it annoys me every single time that stupid box pops up. – Simon Jun 12 '13 at 17:38
  • @Dodomaroc yes, in the way of design many aspects are opinion...I was just trying to be helpful. I could have worded it better, I suppose but I have seen a lot of these and, as Simon said, "Its (nearly always) bad design..." – codeMagic Jun 12 '13 at 17:46
  • @Simon Sorry for misinterpretation, I was talking more about computer's app (like Word). Sure I agree that for a mobile environment, such a feature is very unpleasant for the user (mainly if the app is often used). – Alexis C. Jun 12 '13 at 17:47

1 Answers1

0

You can create a sub class of Activity(for example SubActivity1).Now all other Activities that you create in your App must extend SubActivity1.Then create a static class with a static list of type SubActivity1 and try to add instance of each activity during it's onCreate() method(when it is created first time) to that list in that static class.Finally when you need to close all Activities,simply call finish() for all Activities in list.

hasanghaforian
  • 13,858
  • 11
  • 76
  • 167