Setting the Wallpaper from an Image on the SDCard

后端 未结 1 1149
栀梦
栀梦 2021-01-16 06:11

How would one go about setting the homescreen wallpaper from an image on the SDcard?

i.e.:

try {
    wallpaperManager.setResource(\"/sdcard/wallpape         


        
1条回答
  •  余生分开走
    2021-01-16 07:01

    Bitmap o = BitmapFactory.decodeFile("/sdcard/wallpapers/olive.jpg");
    
    try {
      wallpaperManager.setBitmap(o);
      finish();
    } 
    catch (IOException e) {
      e.printStackTrace();
    }
    

    0 讨论(0)
提交回复
热议问题