J
J
jestev2017-07-09 18:35:41
Java
jestev, 2017-07-09 18:35:41

Why onfinish(); closes the whole application?

It is necessary to close the current activity when calling the method onfinish();and return to the main one, but instead the entire application is closed. I pass from MainActivity to ActivityAbout and back. What is the problem? Maybe add something to the manifest?
MainActivity.class

public void onClickGo(View view) {
       Intent intent = new Intent(MainActivity.this, ActivityAbout.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }

ActivityAbout.class
public void onClickBack(View view) {
    finish();
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-07-10
@zagayevskiy

Because we are reading the FLAG_ACTIVITY_NEW_TASK documentation . You don't need this flag.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question