如何让用户手动设置墙纸?

问题描述 投票:0回答:1

我确实设置了墙纸功能,但不是这样手动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
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.