简体   繁体   中英

How to make launcher chooser pop up even the default launcher is set

I am doing a launcher app now, may I know how to make launcher chooser pop up even the default launcher is set? I know it is possible to choose two default launchers in Jelly Bean or above version, could anyone teach me how to do that? thanks.

my code is as below:-

        Intent selector = new Intent();
        selector.setAction(Intent.ACTION_MAIN);
        selector.addCategory(Intent.CATEGORY_HOME);
        selector.addFlags( Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET );
        activity.startActivity(selector);

Try the following:

Intent selector = new Intent();
selector.setAction(Intent.ACTION_MAIN);
selector.addCategory(Intent.CATEGORY_HOME);
selector.addFlags( Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET );
startActivity(Intent.createChooser(selector, "Select your app:"));

Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM