Android设置桌面壁纸代码

来源:互联网 发布:php switch case 大于 编辑:程序博客网 时间:2024/05/01 14:40

其实就一句,不过前面需要先获取bitmap对象。

        Resources res=getResources();          BitmapDrawable bmpDraw=(BitmapDrawable)res.getDrawable(R.id.abc);        Bitmap bmp=bmpDraw.getBitmap();        try{            setWallpaper(bmp);        }catch(IOException e) {            e.printStackTrace();        }


至于如何设置待机壁纸,暂时还不太清楚~!