I am setting an image from within my application as wallpaper it is working fine on my nokia 5 and image is being set and is filling the entire view but when i try to run the same code on huawei honor 5x or nexus 4 the image is enlarged and goes out of the home screen.
private Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) {
int width = bm.getWidth();
int height = bm.getHeight();
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
// create a matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// recreate the new Bitmap
Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true);
return resizedBitmap;
}