group multiple apps under the same icon in Application launcher
I want to group multiple apps under the same icon in the application launcher. For example, 5 apps each displaying 1 different image. But those 5 apps should appear as separate apps on the Android market, therefore they need to have different package name.
But different package name, means that on the Android device they will appear as 5 separate apps in the application launcher, which I am trying to avoid.
The c开发者_如何学JAVAlosest solution that I found is to listen for PACKAGE_ADDED
broadcast event, and every time another app from those 5 are installed on the device, all the already installed apps would call setApplicationEnabledSetting
from PackageManager
to hide their icons and let the app that was just installed to handle things.
But the icons are hidden only after rebooting the device.
Is there a way to force the application launcher to refresh at runtime? Or is there any other way to solve my goal? I am running out of options. Thanks!
Miha,
What about having one main application, with the other 4 being add-ons (i.e., not shown in the launcher)? You would then have only one launcher icon, and the other applications would be started from the main app. By checking whether the other apps were installed, you could adjust your buttons/views accordingly.
As far as I know, there is no way to force the launcher to refresh. However, you could implement your applications as you described -- having each app hide it's icon when I new one is installed. The user would get an application not installed error though, which is probably not something you want.
Personally, I used the first method: have a main keyboard and then install add-ons which can then be loaded from the main app.
Hope this helps.
精彩评论