I have tried to change wallpaper on android. but it jut shows a portion of the image. however if I lock the phone the lockscreen show the image perfectly scaled but only while the app is running, on exit the lockscreen shows the same as the background?
help!?
WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext());
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
int height = metrics.heightPixels;
Bitmap original = BitmapFactory.decodeResource(getResources(), R.drawable.day_cloudy);
Bitmap resized = Bitmap.createScaledBitmap(original, width, height, true);
try {
wallpaperManager.clear();
wallpaperManager.setWallpaperOffsetSteps(1, 1);
wallpaperManager.suggestDesiredDimensions(resized.getWidth(), resized.getHeight());
wallpaperManager.setBitmap(resized);
Toast.makeText(this, "Wallpaper Set", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}