I need to have access to the current cropped wallpaper (as a drawable or a bitmap) in order to blur some part of it and set these blurred parts as backgrounds for different views.
In Android, it is possible to get the current wallpaper as a drawable by calling WallpaperManger.getDrawable()
. However, this method returns the complete drawable, that is often cropped by the user. The result is that when using this drawable, the wallpaper is distorted and cannot be used as a background for a view and be blurred since there is no way to "undistort it".
An alternative would be to set the activity as transparent and setting windowShowWallpaper
to true
. The problem with this approach is that the wallpaper cannot be accessed. Calling getWindow().getDecorView().getBackground()
returns nothing as there is no background. The activity is just transparent and shows the wallpaper behind it.