Java 从文件路径设置壁纸
我已经找到了很多关于如何从一个可绘制的等设置墙纸的细节,但是可以从一个文件位置这样做 我已经确认以下代码打印出了文件的位置Java 从文件路径设置壁纸,java,android,file,path,wallpaper,Java,Android,File,Path,Wallpaper,我已经找到了很多关于如何从一个可绘制的等设置墙纸的细节,但是可以从一个文件位置这样做 我已经确认以下代码打印出了文件的位置 Toast.makeText(MyWallpapers.this, "" + listFile[position].getAbsolutePath(), Toast.LENGTH_SHORT).show(); String ImageLocation = listFile[position].getAbsolutePath(); 所以我一直在尝试这样的东西,让它来设置壁
Toast.makeText(MyWallpapers.this, "" + listFile[position].getAbsolutePath(), Toast.LENGTH_SHORT).show();
String ImageLocation = listFile[position].getAbsolutePath();
所以我一直在尝试这样的东西,让它来设置壁纸
WallpaperManager myWallpaperManager
= WallpaperManager.getInstance(getApplicationContext());
try {
myWallpaperManager.setResource(ImageLocation);
} catch (IOException e) {
e.printStackTrace();
}
但它不喜欢它
有什么建议吗?将文件加载到using and call中将文件加载到using and call中