AndroidアプリからAPIをつかってスクリーンショットを撮影する方法を紹介します。Android 4.4(SDK Level.20以下)の端末では、Androidアプリからスクリーンショットを保存する汎用的なAPIはありませんでした。特にセキュリティが大きな要因です(記事の末尾に経緯を記載しました。読んでみてください)。 Android 5.0 (Lollipop / Android SDK Level 21)からはMediaProjection APIを使うことで、スクリーンショットが撮影できます。 またGoogleのサンプルプロジェクトではBitmapの取得ではなく、SurfaceViewへの常時反映(ミラーリング、スクリーンキャプチャし続ける)の例があります。Fragmentをつかっており、サンプルとしてはやや複雑な構成です。本記事を読んだあとに参照するとスムーズでしょう。 ht