Android使用意图设置墙纸
问题描述:
我正在尝试制作墙纸应用程序.我可以使用墙纸管理器设置墙纸.但是我想要的是,当我单击按钮时,应该打开一个新的意图,这应该是设置设备墙纸的默认方式.(当我们尝试将图像表单库设置为墙纸时得到的屏幕,我们可以在其中选择图像区域等).我go了一下,但找不到任何解决方案.
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 the default way of setting wallpaper of the device. (the screen we get when we try to set an image form gallery as wallpaper, where we can select the area of the image etc etc). I have goggled but couldn't find any solution.
答
如果您不必指定目标应用,这是一个更好的解决方案;
This is a better solution, wher you dont have to specify a target app;
Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(Intent.createChooser(intent, "Select Wallpaper"));