Android examples for android.graphics:Bitmap Operation
setup Wallpaper from Bitmap file path
//package com.java2s; import java.io.File; import java.io.IOException; import android.app.WallpaperManager; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Log; public class Main { public static boolean setupWallpaper(File file, Context context) { if (file == null) { throw new IllegalArgumentException("file is null"); }// w ww . j a v a2s. co m Bitmap bitmap = BitmapFactory.decodeFile(file.getPath()); WallpaperManager wallpaperManager = WallpaperManager .getInstance(context); try { wallpaperManager.setBitmap(bitmap); return true; } catch (IOException e) { Log.e("rsmapp", "WallpaperThread:" + e.getMessage()); e.printStackTrace(); } return false; } }