由网友(该用户身份不明)分享简介:一个人怎么会去从图像设置主屏幕壁纸上的SD卡? 即:尝试{wallpaperManager.setResource(/ SD卡/壁纸/ olive.jpg);完();}赶上(IOException异常E){e.printStackTrace();}没有工作,返回了一个错误:该方法setResource(INT)在类...
一个人怎么会去从图像设置主屏幕壁纸上的SD卡?
即:
尝试{
wallpaperManager.setResource(/ SD卡/壁纸/ olive.jpg);
完();
}赶上(IOException异常E){
e.printStackTrace();
}
没有工作,返回了一个错误:该方法setResource(INT)在类型WallpaperManager不适用的参数(字符串)
解决方案 位图O = BitmapFactory.de codeFILE(/ SD卡/壁纸/ olive.jpg);
尝试 {
wallpaperManager.setBitmap(O);
完();
}
赶上(IOException异常E){
e.printStackTrace();
}
How would one go about setting the homescreen wallpaper from an image on the SDcard?
i.e.:
try {
wallpaperManager.setResource("/sdcard/wallpaper/olive.jpg");
finish();
} catch(IOException e) {
e.printStackTrace();
}
hasn't worked, returned an error: 'The method setResource(int) in the type WallpaperManager is not applicable for the arguments (String)'
解决方案Bitmap o = BitmapFactory.decodeFile("/sdcard/wallpapers/olive.jpg");
try {
wallpaperManager.setBitmap(o);
finish();
}
catch (IOException e) {
e.printStackTrace();
}
相关推荐
最新文章