[Apidemos for Android samples video series] app-activity-setwallpaper

Source: Internet
Author: User

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.

 
  1. Final wallpapermanager
  2. = Wallpapermanager. getinstance (this );
  3. Final drawable wallpaperdrawable
  4. = Wallpapermanager. getdrawable ();
  5. Final imageview
  6. = (Imageview) findviewbyid (R. Id. imageview );
  7. Imageview. setdrawingcacheenabled (true );
  8. Imageview. setimagedrawable (wallpaperdrawable );

Reset wallpaper through wallpapermanager.

 
  1. 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

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.