Android/ライブ壁紙作成/ライブ壁紙Preview表示
提供: 初心者エンジニアの簡易メモ
// APIレベル16以上の場合のみ(android4.1
// @ex
// String wpPkg = WallpaperService.class.getPackage().getName();
// String wpCls = WallpaperService.class.getCanonicalName();
public static void execOpenLivePreview(Context context, String wpPkg, String wpCls) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
Intent intent = new Intent();
// APIレベル16以上の場合はライブ壁紙のプレビュー画面に遷移
intent.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(wpPkg, wpCls));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
}
