获取SD卡上应用程序的图标
您好,我的 SD 上有一个应用程序(未安装,只是存储在那里),如何通过提供应用程序的路径来获取有关它的信息。例如,我的下载文件夹中有 pandora.apk,因此路径是 /sdcard/download/pandora.apk 知道该路径如何获取它的图标。感谢您的帮助,
我尝试过这段代码,但得到了 nullpointerException
final PackageManager pm = context.getPackageManager();
PackageInfo packageInfo = pm.getPackageArchiveInfo("/sdcard/download/pandora.apk", 0);
Drawable icOn = packageInfo.applicationInfo.loadIcon(context.getPackageManager());
Hi I have an application on my sd (not installed just stored there) how can I get information about it by just giving the path to the application. For instance I have pandora.apk sitting in my downloads folder so the path is /sdcard/download/pandora.apk knowing that path how can i get the icon of it. Thanks for any help
I've tried this code but get a nullpointerexception
final PackageManager pm = context.getPackageManager();
PackageInfo packageInfo = pm.getPackageArchiveInfo("/sdcard/download/pandora.apk", 0);
Drawable icOn = packageInfo.applicationInfo.loadIcon(context.getPackageManager());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经在这里回答了。 如何在我的文件管理器中显示 apk 的图标
Its already answered here. How to show icon of apk in my File manager