2016-08-06 7 views
2
public HeavyLifter(Context context, Handler callback) { 
     this.context = context; 
     this.callback = callback; 
     this.manager = (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE); 
    } 

Error: Suspicious cast to WallpaperManager for a WALLPAPER_SERVICE: expected WallpaperService [ServiceCast] this.manager = (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE);bekomme ich folgende Fehlermeldung, wenn ein Hintergrundbild

Wie stellt man versuchen kann ich dieses Problem beheben?

Antwort

0

Sie sollten die getInstance() Methode von WallpaperManager verwenden, um eine Instanz zu erhalten.

Ändern Sie die folgenden Schritte aus:

this.manager = (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE); 

Um dies:

this.manager = WallpaperManager.getInstance(context); 
+0

Danke .. Das half .. –

Verwandte Themen