Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Launcher获取相机图标和标签_Android_Camera_Icons_Launcher - Fatal编程技术网

Android Launcher获取相机图标和标签

Android Launcher获取相机图标和标签,android,camera,icons,launcher,Android,Camera,Icons,Launcher,我试图复制Android默认的应用程序网格,加载所有“可启动”的应用程序 我是这样做的 //generate the intent to get the application list final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); PackageManager manager = getPackageManag

我试图复制Android默认的应用程序网格,加载所有“可启动”的应用程序

我是这样做的

//generate the intent to get the application list 
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);

PackageManager manager = getPackageManager();
applicationList = manager.queryIntentActivities(mainIntent, 0);

//sort the list 
Collections.sort(applicationList, new ResolveInfo.DisplayNameComparator(manager));

//user in calculating percentage. 
if (applicationList.size() > 0 ){
    for (ResolveInfo info : applicationList) {
一旦我将列表处理为在网格视图中显示应用程序的名称+图标,但当涉及到相机时,我会不断获得Gallery标签和图标

要获取我使用的标签,请执行以下操作:

PackageManager manager = getPackageManager();
(String) manager.getApplicationLabel(applicationInfo)
用于获取图标

info.loadIcon(getContext().getPackageManager());
其中info是ApplicationInfo对象

我想知道会发生什么事

到目前为止,我刚刚注意到这个应用程序,但它可能是另一个

有人知道如何从Camera ResolveInfo获取Camera应用程序吗

在调试过程中,我做了一个屏幕截图,这是我为ResolveInfo获得的信息

谢谢你的建议。 塞萨尔·格雷兹

我想知道会发生什么事

您将获得应用程序的图标和标签。“照相机”和“画廊”来自一个应用程序,有两个可启动的活动

您需要获取活动的图标和标签,而不是应用程序。在
ResolveInfo
上调用
loadLabel()
loadIcon()
,以获取
ResolveInfo
指向的活动的图标和标签


演示如何构建这样一个启动器,它可以正确地获取相机活动图标作为其入口。

非常感谢。如果还有一个问题,你能给我指出一些关于这方面的文档吗?因为我还不清楚我可以从每个应用程序中获得哪些信息。@cesaregb:获取关于。。。什么
PackageManager
ApplicationInfo
ResolveInfo
和kin都在JavaDocs中。