M
M
MdaUZH2016-08-28 18:54:51
Android
MdaUZH, 2016-08-28 18:54:51

How to prevent the activity from returning to the past and remove it from memory?

Hello everyone, how can I forbid returning to the previous activity and delete it from memory?
As far as I know, disable it:

@Override
    public void onBackPressed() {
        // do nothing
    }

But how to remove the past activity from memory, otherwise it turns out that there will be no return, but it hangs there ...?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry, 2016-08-29
@Scotik

how would I think it’s better for you to play around with Intent.flags, that is, in the mainfest, you can specify that the first one is activated, for example, in the backstack of the activity, or in general 1 instance in the task, or add noHistory to the mainfest in the activity, it also helps, but not very correctly, it is best to read about the flags, the most correct will be
a link read about "Using the mainfest file"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question