WallpaperManager wpm = WallpaperManager.getInstance(getBaseContext());
try {
wpm.setResource(R.drawable.lc);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-----------------------------
| If you have image URL then use WallpaperManager wpm = WallpaperManager.getInstance(context); InputStream ins = new URL("absolute/path/of/image").openStream(); wpm.setStream(ins);
If you have image URI then use WallpaperManager wpm = WallpaperManager.getInstance(context); wpm.setResource(Uri.of.image);
In your manifest file: <uses-permission android:name="android.permission.SET_WALLPAPER"></uses-permission>
| answered Oct 18 '12 at 10:06 |
|
沒有留言:
張貼留言