I know that I can either catch a NameNotFoundException from the call to PackageManager.getPackageInfo , or skip the PackageInfo list returned by PackageManager.getInstalledPackages to find out if a particular package is installed, but both of them seem long perverted or ugly. I have more than 300 packages installed on my personal phone, so I would not want to do this operation every time I need to check. And catching an exception as a means of executing applied logic just makes me feel wrong with everything. Am I missing the isPackageInstalled method somewhere, or do I just need to implement it myself using one of the above methods? And if the latter, which will be considered a faster and less resource-intensive option?
source share