android判断应用是否为默认

Intent mHomeIntent = new Intent(Intent.ACTION_MAIN);
mHomeIntent.addCategory(Intent.CATEGORY_HOME);
mHomeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);

ResolveInfo mInfo = getPackageManager().resolveActivity(mHomeIntent, 0);
String activity_name = mInfo.activityInfo.name;
String package_name = mInfo.activityInfo.packageName;
String toast_content = "";
System.out.println("activity_name:" + activity_name);
System.out.println("package_name:" + package_name);

 

新的博客地址 http://ihongqiqu.com

posted @ 2013-01-05 17:00  哀莫  阅读(1736)  评论(0编辑  收藏  举报

欢迎访问我的主页!