2013-10-12 2 views
2

Je veux obtenir le fond d'écran actuel du mobile et définir cette image comme image de fond de l'application. J'ai essayé de cette façon, mais son spectacle un moment de l'exécution exceptioncomment définir le fond d'écran actuel comme mon fond d'image de l'application Android?

final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); 
final Drawable wallpaperDrawable = wallpaperManager.getDrawable(); 
layout.setBackground(wallpaperDrawable); 
+0

Check [Ce] (http://stackoverflow.com/questions/14713731/use-phone-wallpaper-as-app-background-theme -wallpaper-like-behavior) –

Répondre

1
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); 
final Drawable wallpaperDrawable = wallpaperManager.getFastDrawable(); 
getWindow().setBackgroundDrawable(wallpaperDrawable); 
+0

Que faire si l'utilisateur utilise un fond d'écran en direct? Comment définir le fond d'écran en direct en arrière-plan de l'application? –