[英]How to show a specific app's icon from the installed apps on android programmatically?
I want to show a specific app's icon from my installed apps, not every apps icon.我想从我安装的应用程序中显示特定应用程序的图标,而不是每个应用程序图标。
First I want to check if that package is installed or not, to do that I got help from the answers of this question-首先,我想检查是否安装了 package,为此我从这个问题的答案中得到了帮助-
How to check programmatically if an application is installed or not in Android? 如何以编程方式检查 Android 中是否安装了应用程序?
Then if that package is installed, I want to show that package's app icon in my application and want to launch it by tapping on it.然后,如果安装了 package,我想在我的应用程序中显示该包的应用程序图标,并希望通过点击它来启动它。
Please help.请帮忙。 Thanks in advance.
提前致谢。
You can get it from PackageManager.您可以从 PackageManager 获取它。
Drawable appIcon = getPackageManager().getApplicationIcon("apps.package.name");
check the below link https://developer.android.com/reference/android/content/pm/PackageManager.html检查以下链接https://developer.android.com/reference/android/content/pm/PackageManager.html
You can add a click event with intent to start the new app.您可以添加一个单击事件以启动新应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.