tags:

views:

105

answers:

2

Hi Folks,

when i click a button my app should be terminated. It must not to run at the background. that is when holding the home key, My App should not be alive. For Example, i have to redirect my app to the browser. then My App goes to as a background Task. I want to terminate before the redirection to browser. How is it Possible? Any Idea? Better I would need a Explanation on that. that helps to understand How it works to EveryBody.

Thanks in Advance.

+3  A: 

http://developer.android.com/guide/topics/fundamentals.html#clearstack

The finishOnTaskLaunch attribute
This attribute is like clearTaskOnLaunch, but it operates on a single activity, not an entire task. And it can cause any activity to go away, including the root activity. When it's set to "true", the activity remains part of the task only for the current session. If the user leaves and then returns to the task, it no longer is present.

.. or something like this. I'm new to android, and had just past this part of the docs, and I thought it might help.

EDIT: maybe call finish() in onPause()?

The Guy Of Doom
@The Guy Of Doom: finish() does just finish the current Activity. if we set the attribute to the <application> tag. its globalize for the whole app. i want to just when click the button it shuts off. like Task Manager App. Any Other Idea to do that by Programmatically not in Manifest?
Praveen Chandrasekaran
2 ways: build the functionality to kill a task like a task manager or ignore it. Thats how Android was designed... it takes care of itself, no real need to "finish" an application.
WarrenFaith
A: 

Like the answer above already said:

finish();
return;

Good luck
Tom

TomTasche