Android 如何从应用程序重定向到我的特定实时墙纸预览,而不是选择墙纸的列表视图?
嗨,我正在开发android应用程序,我需要重定向到我的特定实时壁纸预览屏幕。目前,它打开列表,其中列出了所有可用的壁纸 要选择我的壁纸,我必须从列表中选择任何人,然后在预览我的壁纸时发送给我。我想跳过选择实时壁纸屏幕的列表,并自动重定向以设置特定壁纸的实时壁纸屏幕 下面的代码只需打开列出所有墙纸的listview 提前谢谢Android 如何从应用程序重定向到我的特定实时墙纸预览,而不是选择墙纸的列表视图?,android,android-layout,android-intent,live-wallpaper,Android,Android Layout,Android Intent,Live Wallpaper,嗨,我正在开发android应用程序,我需要重定向到我的特定实时壁纸预览屏幕。目前,它打开列表,其中列出了所有可用的壁纸 要选择我的壁纸,我必须从列表中选择任何人,然后在预览我的壁纸时发送给我。我想跳过选择实时壁纸屏幕的列表,并自动重定向以设置特定壁纸的实时壁纸屏幕 下面的代码只需打开列出所有墙纸的listview 提前谢谢 private int REQUEST_CODE = 1; Intent intent = new Intent(); intent.setAction(Wallpaper
private int REQUEST_CODE = 1;
Intent intent = new Intent();
intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
startActivityForResult(intent, REQUEST_CODE);
此解决方案适用于API 15及更高版本。:)
Intent i = new Intent();
if(Build.VERSION.SDK_INT > 15){
i.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
String p = MyServiceClass.class.getPackage().getName();
String c = MyServiceClass.class.getCanonicalName();
i.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(p, c));
}
else{
i.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
}
startActivityForResult(i, 0);