How can I show the home screen on application launch?
I want my application which h开发者_JAVA技巧as only transparent Views, when launched, to show the home screen of the mobile on the backgound instead of the app screen.
I believe this is achieved by using the activity intents in the manifest xml but so far I haven't been able to find a way to do it.
I'd appreciate it if someone could point me to the right direction.
Sorry. I misread the question. I saw the part about only transparent views and took off from there. It appears that an intent with Intent.ACTION_MAIN
and Intent.CATEGORY_HOME
should launch the home screen.
I'm not sure of the best way to launch first the home screen, then your transparent activity. If you're doing this from another activity, I'd probably experiment with putting another startActivity() in the first activity's onPause() or onStop(). That is, put a startActivity() for the launcher wherever it belongs, and at the same time, set a variable like isLaunchingTransparentActivity; then in onPause() or onStop(), if isLaunchingTransparentActivity is true, call startActivity() with an intent for the transparent activity.
Alternately, you could create a home screen widget. If you launch from an app icon, use a non-transparent activity. If the user presses the widget (which requires being on the home screen), use the transparent one.
精彩评论