【发布时间】:2019-10-31 20:11:11
【问题描述】:
我确实设置了墙纸功能,但不是像这样手动设置的 set wallpaper
代码:
private void setWallpaper()
{
Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap();
WallpaperManager manager = WallpaperManager.getInstance(getApplicationContext());
try {
manager.setBitmap(bitmap);
Toast.makeText(ViewWallpaperActivity.this,"Done!",LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(ViewWallpaperActivity.this,"Error!",LENGTH_LONG).show();
}
}
【问题讨论】:
-
我的代码结果相同
-
您是否在清单中添加了权限?
标签: android