One of the compelling user features of the Android platform is the ability to customize many aspects of the user experience. Among these is the ability to customize the home screen wallpaper with something other than a static image. A “live” wallpaper can contain images, animations, interactive features or whatever you, the developer, desires.
After that, you’ll get a list of all the live wallpapers available:
And then an animated preview, when you choose Stars.
Android Interactive Wallpapers
Live wallpapers can receive touch events and react to them. In the context of using the helper classes introduced above, simply override the onCommand()
method of RenderScriptScene, look for the WallpaperManager.COMMAND_TAP, and take some action based on the position of the tap. Although this is beyond the scope of this tutorial, the code download includes a little extra for readers to enjoy.
Conclusion
You’ve learned how to create a simple Android live wallpaper. While doing so, you’ve also learned about some of the benefits of open source projects, and a fast method of creating a RenderScript-based wallpaper. Can you modify the script to make colored stars? Make the stars float towards you? Let us know what awesome live wallpapers you’ve created!
About the Authors
Shane Conder and Lauren Darcey—Contributing Editors, Mobile Development–have coauthored two books on Android development: an in-depth programming book entitled Android Wireless Application Development (ISBN-13: 978-0-321-62709-4) and Sams Teach Yourself Android Application Development in 24 Hours (ISBN-13: 978-0-321-67335-0). When not writing, they spend their time developing mobile software at their company and providing consulting services. |