My problem is the image previewed on the imageview is not able to set fully as background wallpaper. Some part of it cuts. this is my onclick of button
setasW.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mImage.buildDrawingCache();
Bitmap bmap = mImage.getDrawingCache();
float scaleWidth = ((float) width) / bmap .getWidth();
float scaleHeight = ((float) height) / bmap .getHeight();
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap scaledBitmap = Bitmap.createBitmap(bmap, 0, 0,bmap .getWidth(), bmap .getHeight(), matrix, true);;
System.out.println("scaledBitmap-------"+scaledBitmap);
WallpaperManager m=WallpaperManager.getInstance(getApplicationContext());
try {
m.setBitmap(scaledBitmap);
} catch (IOException e) {
e.printStackTrace();
}
}
});
here mimage is the imageview Width and height are the screen size.
How to set the full image as wallpaper?