void SetWallpaper(Bitmap b)
{
Bitmap bmImg = b;
try {
String filepath=Environment.getExternalStorageDirectory().getAbsolutePath();
FileOutputStream fos = new FileOutputStream(filepath + "/" + "output.jpg");
bmImg.compress(CompressFormat.JPEG, 75, fos);
fos.flush();
fos.close();
Context context = this.getBaseContext();
context.setWallpaper(bmImg);
MessageBox("Image set as Wallpaper");
}
catch (Exception e)
{
e.printStackTrace();
}
}
No comments:
Post a Comment