Android Set Wallpaper Using Intent
I am trying to make wallpaper application. I am able to set the wallpaper using wallpaper manager. But what i want is when i click a button a new intent should open which should be
Solution 1:
This is a better solution, wher you dont have to specify a target app;
Intentintent=newIntent(Intent.ACTION_SET_WALLPAPER);
startActivity(Intent.createChooser(intent, "Select Wallpaper"));
Solution 2:
Use "android.intent.action.SET_WALLPAPER"
+ set component/class of your wallpaper application so that the Intent would be handled by your app.
For example, that'd look like as follows for AOSP built-in wallpaper application:
Intentintent=newIntent("android.intent.action.SET_WALLPAPER");
// Change the following line with that of your own app
intent.setClassName("com.android.launcher", "com.android.launcher2.WallpaperChooser");
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.wtf(TAG, "No activity found to handle " + + intent.toString());
}
Solution 3:
I know its late but for someone to wants, its works for me.
finalWallpaperManagerwallpaperManager= WallpaperManager.getInstance(this);
finalDrawablewallpaperDrawable= wallpaperManager.getDrawable();
try {
wallpaperManager.setBitmap(yourImageView.getDrawingCache());
finish();
} catch (IOException e) {
e.printStackTrace();
}
Post a Comment for "Android Set Wallpaper Using Intent"