首页 > 移动平台 > 详细

修改app的默认设置(包括修改默认launcher)

时间:2015-07-20 16:36:35      阅读:471      评论:0      收藏:0      [点我收藏+]

1、改为自己的launcher

ComponentName component = new ComponentName(
context.getPackageName(), MainActivity.class.getName());//红色为自己的launcher入口
ComponentName[] components = new ComponentName[] {
new ComponentName("com.android.launcher",
"com.android.launcher2.Launcher"), component };
pm.clearPackagePreferredActivities("com.android.launcher");//清除默认launcher
pm.addPreferredActivity(filter, IntentFilter.MATCH_CATEGORY_EMPTY,
components, component);

2、改为系统的launcher


ComponentName component = new ComponentName("com.android.launcher",
"com.android.launcher2.Launcher");
ComponentName[] components = new ComponentName[] {
new ComponentName(context.getPackageName(), MainActivity.class.getName()), component };
pm.clearPackagePreferredActivities("com.android.launcher");
pm.addPreferredActivity(filter, IntentFilter.MATCH_CATEGORY_EMPTY,
components, component);


3、参考资料

http://blog.csdn.net/wh_19910525/article/details/39025425

http://blog.csdn.net/lwyygydx/article/details/42873829

http://www.07net01.com/2014/09/79947.html

http://blog.csdn.net/jia4525036/article/details/18036765


版权声明:本文为博主原创文章,未经博主允许不得转载。

修改app的默认设置(包括修改默认launcher)

原文:http://blog.csdn.net/longtian635241/article/details/46968073

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!