我正在按照this教程创建我的第一个实时墙纸。但是我在这两行得到了error can not be resolved or is not a field
WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT
在努力实现这一目标的同时
Intent intent = new Intent( WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
new ComponentName(this, LiveWallService.class));编译器提供了以下提示:
WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER
WallpaperManager.COMMAND_DROP
WallpaperManager.COMMAND_SECONDARY_TAP
WallpaperManager.COMMAND_TAP
WallpaperManager.WALLPAPER_PREVIEW_META_DATA有什么不对劲吗...?
发布于 2013-01-14 19:03:29
WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER仅在API级别16 (4.1.2)中添加。也许您已经将目标SDK版本设置为低于16的版本?
在API级别16以下,您只能使用intent action WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER,将用户发送到整个LWP选择屏幕,并告诉他从那里选择您的墙纸。您可以通过以下方式设置代码:
Intent i = new Intent();
if(Build.VERSION.SDK_INT >= 16)
{
i.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
i.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(packageName, canonicalName));
}
else
{
i.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
}
// send intenthttps://stackoverflow.com/questions/14317167
复制相似问题