取得Android系统全部app
2013-05-06 20:19
169 查看
PackageManager pm = ctx.getApplicationContext().getPackageManager();
appList = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
--------------------------------------------
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
mApps = getPackageManager().queryIntentActivities(mainIntent, 0);
--------------------------------------------
//下面是android2.2 Launcher源代码的LauncherModel用到的代码
final Intent mainIntent = new Intent( Intent.ACTION_MAIN, null );
mainIntent.addCategory( Intent.CATEGORY_LAUNCHER );
final PackageManager packageManager = mContext.getPackageManager();
List<ResolveInfo> apps = null;
//获取系统全部的应用程序
//在指定的intent中获取所有可能执行的activity列表
apps = packageManager.queryIntentActivities( mainIntent, 0 );
//APP总数
int N = apps.size();
-------------------------------------------------------------------------------------------------------------------------------------------------
在Activity里操作:
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager mPackageManager = getPackageManager();
//符合上面条件的全部查出来,并且排序
List<ResolveInfo> mAllApps = mPackageManager.queryIntentActivities(mainIntent, 0);
Collections.sort(mAllApps, new ResolveInfo.DisplayNameComparator(mPackageManager));
#android学习笔记
appList = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);
--------------------------------------------
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
mApps = getPackageManager().queryIntentActivities(mainIntent, 0);
--------------------------------------------
//下面是android2.2 Launcher源代码的LauncherModel用到的代码
final Intent mainIntent = new Intent( Intent.ACTION_MAIN, null );
mainIntent.addCategory( Intent.CATEGORY_LAUNCHER );
final PackageManager packageManager = mContext.getPackageManager();
List<ResolveInfo> apps = null;
//获取系统全部的应用程序
//在指定的intent中获取所有可能执行的activity列表
apps = packageManager.queryIntentActivities( mainIntent, 0 );
//APP总数
int N = apps.size();
-------------------------------------------------------------------------------------------------------------------------------------------------
在Activity里操作:
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager mPackageManager = getPackageManager();
//符合上面条件的全部查出来,并且排序
List<ResolveInfo> mAllApps = mPackageManager.queryIntentActivities(mainIntent, 0);
Collections.sort(mAllApps, new ResolveInfo.DisplayNameComparator(mPackageManager));
#android学习笔记
相关文章推荐
- 取得Android系统全部app
- 给Android app签上系统签名以取得root权限
- 如何取得Android 系统的源代码--全部
- 怎样使一个Android应用不被杀死//Android: HowTo设置app不被系统kill掉
- Android自用-----系统自带app与用户app
- Android Launcher分析和修改7——AllApp全部应用列表(AppsCustomizeTabHost)
- Android中获取系统上安装的APP信息
- 编译android文件系统4.0.4错误全部解析
- 如何把应用程序app编译进android系统
- android 改变app亮度不影响系统亮度(获取系统亮度)
- Android系统App中使用Leakcanary
- android去掉系统状态栏(StatusBar),让所有app程序均是全屏显示
- android取得系统高度,标题栏和状态高度
- android取得系统高度,标题栏和状态高度
- Android系统app内存基础常识
- Android系统自带App分析(短信App)
- Android App安装成系统应用
- [置顶] Android 7.0 系统解决拍照的问题 exposed beyond app through ClipData.Item.getUri()
- 关于Android切换系统字体大小和字体样式导致App崩溃或者界面错乱的问题
- (The one day)About Android 系统状态栏与APP主题颜色一致(方法二)