2016-08-06 19 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);私は壁紙私はこの問題を解決するにはどうすればよい

を設定しようとすると次のエラーを取得しますか?

答えて

0

インスタンスの取得には、getInstance()メソッドをWallpaperManagerとする必要があります。

変更は次のとおりです。これに

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

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

が助けたこと..ありがとう.. –

関連する問題