1. Demo description and demonstration
This demo describes how to obtain the current wallpaper in Android, modify wallpaper, and then reset the wallpaper with the modified image. Note that you must add the permission <uses-Permission android in androidmainfest: name = "android. permission. set_wallpaper "/>
The demo is as follows:
2. Video description
Http://www.eyeandroid.com/thread-10887-1-1.html
3. Demo Analysis
Setwallpaper describes how to get the current wallpaper in Android, modify the wallpaper, and then reset the wallpaper with the modified image.
Wallpapermanager is used to manage Android wallpaper. The following code uses wallpapermanager to obtain the current wallpaper and display it on the imageview of the screen layout.
- Final wallpapermanager
- = Wallpapermanager. getinstance (this );
- Final drawable wallpaperdrawable
- = Wallpapermanager. getdrawable ();
- Final imageview
- = (Imageview) findviewbyid (R. Id. imageview );
- Imageview. setdrawingcacheenabled (true );
- Imageview. setimagedrawable (wallpaperdrawable );
Reset wallpaper through wallpapermanager.
- Wallpapermanager. setbitmap (imageview. getdrawingcache ());
4. We learned this demo.
• Android wallpaper setting code
Http://www.eyeandroid.com/thread-10638-1-1.html
• View drawingcache
Http://www.eyeandroid.com/thread-8843-1-1.html
• Math. Floor
Http://www.eyeandroid.com/thread-10639-1-1.html
• Android setcolorfilter filter effect
Http://www.eyeandroid.com/thread-10640-1-1.html