facebook twitter hatena line email

Android/ライブ壁紙作成/ライブ壁紙Preview表示

提供: 初心者エンジニアの簡易メモ
2015年5月20日 (水) 03:11時点における127.0.0.1 (トーク)による版 (ページの作成:「 // APIレベル16以上の場合のみ(android4.1 // @ex // String wpPkg = WallpaperService.class.getPackage().getName(); // String wpCls = WallpaperService.class.get...」)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索
// 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);
    }
}