I am developing wallpaper application with set as wallpaper option. I am displaying all images into grid view from Photos directory located on sdcard. when user click any of the image thumbnail it opens up into full screens view where i have provided set as wallpaper option. every thing is working fine. Now the problem is that i want to provide cropping functionality with an option to set image in full screen view without zooming or stretching. i tried many codes but it did not work as per my expectation. I am calling the following function on click event. the below is the code that i have tried but it stretches the image.
enter code here
private void setWallPaper() {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
try {
//set for full screen wallpaper
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int fullHeight = metrics.heightPixels;
int fullWidth = metrics.widthPixels;
Bitmap bitmapResized = Bitmap.createScaledBitmap(imageBitmap, fullWidth, fullHeight,true);
wallpaperManager.setBitmap(bitmapResized);
//wallpaperManager.setBitmap(imageBitmap);
Toast toast = Toast.makeText(this, "Set wallpaper successfully!", Toast.LENGTH_LONG);
toast.show();
} catch (IOException e) {
e.printStackTrace();
}
}
is there any way to bypass this cropping functionality and set image as full screen? Please help me in this regard. thanks in advance.