-3

When the user clicks on the "Close running Apps" Button then every application which is running in the background needs to be closed except my current application. How can I do this?

Thank you

Anil Jadhav
  • 2,128
  • 1
  • 17
  • 31
  • You should not be killing your's or any other apps. Android handles the closing of apps itself not the developer and it is bad practice to kill an app. – Boardy Jul 09 '14 at 10:04
  • Don't do this. Firstly Android does it better, secondly do you really want every other app developers app being killed by yours, do you think your users would want this. What's your app? I want to know so I can be sure to never, ever install it. – RossC Jul 09 '14 at 10:15
  • possible duplicate of [How to kill all running applications in android?](http://stackoverflow.com/questions/7397668/how-to-kill-all-running-applications-in-android) – RossC Jul 09 '14 at 10:16

1 Answers1

2

You could take a look at: How to kill all running applications in android? I think the answer there would really help you

Community
  • 1
  • 1
Reaver
  • 323
  • 3
  • 21
  • link is good one. Proper explanation is present there. – Anil Jadhav Jul 09 '14 at 09:36
  • Sorry ignore what I posted, didn't realise it was a Stack Overflow link. My bad! Have a +1 :) – RossC Jul 09 '14 at 10:17
  • @UserQuestion IN the Code of hasanghaforian it says: `(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);` What is `context` because there is no `context`defined? – user3812130 Jul 09 '14 at 13:02
  • @user3812130 I would advise you to take a look on googles documentation of context, and you could have a look at this post for more information and usage of it: http://stackoverflow.com/questions/3572463/what-is-context-in-android – Reaver Jul 10 '14 at 06:43