简体   繁体   English

如何以编程方式从 android 上已安装的应用程序中显示特定应用程序的图标?

[英]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.

相关问题 Android-显示所有已安装应用的应用选择器 - Android - Show an app chooser of all of the installed apps 如何在 Unity 中获取 Android 安装的应用程序图标 - How to get Android Installed App Icon in Unity 如何让您的应用程序从Android已安装的应用程序中获取数据 - How to let your app take data from apps that are already installed by Android 如何在Android Studio中以编程方式锁定近期应用中的应用 - How to lock app in recent apps programmatically in android studio Android在Logcat中显示已安装的应用 - Android show installed app in logcat 如何以编程方式获取运行 Android 7.0 的设备中已安装浏览器应用程序的列表? - How to get the list of installed Browser Apps in an Android 7.0 running devices programmatically? 防病毒软件如何以编程方式扫描已安装的Android应用程序的代码(没有root权限)? - How do anti-virus software programmatically scan code of installed android apps (without root privileges)? 在一个窗口中运行多个已安装应用的Android应用 - Android App that runs multiple installed apps in a window Firebase:Android:如何显示已安装该应用程序的联系人列表 - Firebase: Android : How to show list of contacts who have the app Installed 如何在Android的ActionBar上为应用程序的图标添加click的侦听器? - How to add click's listener for app's icon on ActionBar in Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM