I am coding an app for Android, where getting a label (actual name) of the application is extremelly slow. Particularly this code is performing really badly:
packageInfo.loadLabel(pm);
Just to give you some metrics. On an Android device with 400 installed applications, it'll take less than a second to build a list of all application packagenames (com.android.*, etc..). However, it'll take over 30 seconds to get an actual name for each of the apps.
I've tried this code as well, but it's pretty much the same result (very slow):
(String)pm.getApplicationLabel(packageInfo);
Question: If application packagename is known (i.e. "com.android.htmlviewer"), is there an alternative way to grab an application name (i.e. "HTML Viewer") quickly?
You could build a database in your app of "known" application names, and update it every time your app comes across a new package. The first run through will take a while, but after that you could save a lot of time by only checking one or two package names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With