Setting wallpaper in Android

前端 未结 3 1943
离开以前
离开以前 2021-01-01 03:25

I am developing a simple app that sets wallpapers based on user input. I am missing code for setting wallpapers. I have been looking for it in lots of websites in vain. Can

3条回答
  •  粉色の甜心
    2021-01-01 03:31

    Works on Android 1.5 and above

    public void setWallpaper() {
      Context context = this.getBaseContext(); 
      Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), mImageIds[pos]);
    
      context.setWallpaper(mBitmap);
    }
    

提交回复
热议问题