Android设置桌面背景图片的方法

1.设置桌面背景图片的方法


    Resources res=getResources();   


                BitmapDrawable bmpDraw=(BitmapDrawable)res.getDrawable(R.drawable.icon);    


                Bitmap bmp=bmpDraw.getBitmap();


                try{


                    setWallpaper(bmp);


                }catch(IOException e) {


                    e.printStackTrace();


                }


2.在manifest中增加设置桌面的权限


    <uses-permission android:name="android.permission.SET_WALLPAPER" />

原文地址:https://www.cnblogs.com/qingblog/p/2597496.html