2010-07-08 8 views
1

Comment procéder pour définir le papier peint de l'écran d'accueil à partir d'une image sur la carte SD?Définition du papier peint à partir d'une image sur la carte SD

i.e. .:

try { 
    wallpaperManager.setResource("/sdcard/wallpaper/olive.jpg"); 
    finish(); 
} catch(IOException e) { 
    e.printStackTrace(); 
} 

n'a pas fonctionné, renvoyé une erreur: 'Le procédé setResource (int) dans le type WallpaperManager est pas applicable pour les arguments (String)'

Répondre

4
Bitmap o = BitmapFactory.decodeFile("/sdcard/wallpapers/olive.jpg"); 

try { 
    wallpaperManager.setBitmap(o); 
    finish(); 
} 
catch (IOException e) { 
    e.printStackTrace(); 
}