Bring activity forward like a launcher does

I had a Global FloatButton, when it is pressed, it should bring activity A to the fore (which is already running). I'll try:

Intent intent = new Intent(ApplicationContext,A.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) ApplicationContext.startActivity(intent); 

it works with active opening very slowly, and a delay of 3 s or more.

But when I click the application icon in the launcher, it opens quickly.

Why and how can Launcher do this?

+5
source share

All Articles