H
H
hudrogen2014-05-30 14:05:07
Java
hudrogen, 2014-05-30 14:05:07

Which function closes an application in Android?

I am writing a program for Android. There are 2 Activities in the program. In the first activity there is a button, when clicked, the user gets to the second activity. It is necessary to make it so that, being in the second activity and when you click on the back button, the application closes, and does not return to the first activity, as by default.

@Override
public void onBackPressed() {
  // TODO Auto-generated method stub
  // super.onBackPressed();
  // Что тут написать для закрытия приложения?
}

Answer the question

In order to leave comments, you need to log in

4 answer(s)
@
@breakmt, 2014-05-30
_

finish();

F
FoxInSox, 2014-05-30
@FoxInSox

There is no such feature. Moreover, the user does not need it, because. it has a home button. It's strange that you need it.
You can call finish on all living Activity instances.

M
Mintormo, 2014-05-31
@Mintormo

Here are a couple more solutions www.androidsnippets.com/kill-you-application

H
hudrogen, 2014-05-30
@hudrogen

I'll answer myself =)
There is a solution here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question