What should I do to call the Native Wallpaper picker to set the Wallpaper for my layout in android?

This is my question. For those who do not know what I'm asking, I want this menu to appear in my application http://db.tt/GQX9GBYF . The fact is that I do not know how to do this. I think that I need to create an intention, get the path to the image from it, and then set it as a background. But I do not know how to do this ...

Please, can someone write me an example, please ????;)

I must say that I managed to do this by running my own gallery application, but I also want to install live wallpapers.

+4
source share
2 answers

You are Intent.ACTION_SET_WALLPAPER to run ContaxtMenu to select wallpapers like:

 Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER); startActivity(Intent.createChooser(intent, "Select Wallpaper")); 
+5
source

I am currently working on the same thing. The accepted answer is correct, but if you want to use the wallpaper as the background of your application, then you should use the "Wallpaper" theme and call Intent.Action_Set_Wallpaper to select the wallpaper.

 public void onCreate(Bundle savedInstanceState) { Activity.this.setTheme(android.R.style.Theme_Wallpaper); super.onCreate(savedInstanceState); setContentView(/*some layout*/); } 

// when the button is pressed

 Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER); startActivity(Intent.createChooser(intent, "Select Wallpaper")); 
+1
source

Source: https://habr.com/ru/post/1414584/


All Articles