开发者

Set wallpaper & return to DEFAULT home screen

开发者 https://www.devze.com 2023-02-01 13:36 出处:网络
After choosing & setting a wallpaper I would like to return to the DEFAULT home screen (i.e. pg 2 of 3) so the user can im开发者_Go百科mediately see the new wallpaper.

After choosing & setting a wallpaper I would like to return to the DEFAULT home screen (i.e. pg 2 of 3) so the user can im开发者_Go百科mediately see the new wallpaper.

Intent intent2 = new Intent(Intent.ACTION_MAIN); intent2.addCategory(Intent.CATEGORY_HOME); intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent2);

The above works fine, but returns to the last home page used, not necessarily the DEFAULT homepage. Is there an EXTRA or FLAG I can use to accomplish this?


Found the answer... use TWO intents!

                    Intent intent2 = new Intent(Intent.ACTION_MAIN);
                    intent2.addCategory(Intent.CATEGORY_HOME);
                    intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(intent2);

                    Intent intent3 = new Intent(Intent.ACTION_MAIN);
                    intent3.addCategory(Intent.CATEGORY_HOME);
                    intent3.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(intent3);
0

精彩评论

暂无评论...
验证码 换一张
取 消