Java tutorial
//package com.java2s; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.media.projection.MediaProjectionManager; import android.util.Log; public class Main { private static final int CREATE_SCREENSHOT = 100; static void fireScreenCaptureIntent(Activity activity) { MediaProjectionManager manager = (MediaProjectionManager) activity .getSystemService(Context.MEDIA_PROJECTION_SERVICE); Intent intent = manager.createScreenCaptureIntent(); activity.startActivityForResult(intent, CREATE_SCREENSHOT); Log.i("TakeScreenshotService", "fireScreenCaptureIntent..."); } }