Get screenshot of current foreground app on Android having root priviliges

Get screenshot of current foreground app on Android having root priviliges

By : rinkesh
Date : November 22 2020, 10:31 AM
should help you out Months have passed since I asked this question but just now had the time to add this feature. The way to do this is simply by calling screencap -p and then grabbing the file. Next is the code I used:
code :
private class WorkerTask extends AsyncTask<String, String, File> {
    protected File doInBackground(String... params) {
        File screenshotFile = new File(Environment.getExternalStorageDirectory().getPath(), SCREENSHOT_FILE_NAME);
        try {
            Process screencap = Runtime.getRuntime().exec("screencap -p " + screenshotFile.getAbsolutePath());
            return screenshotFile;
        } catch (IOException ioe) {
        } catch (InterruptedException ie) {

        return null;

    protected void onPostExecute(File screenshot_file) {
        // Do something with the file.

Share : facebook icon twitter icon
How to capture a screenshot of other Android applications from an app without root?

How to capture a screenshot of other Android applications from an app without root?

By : Alex Tsibulko
Date : March 29 2020, 07:55 AM
I wish this help you Have a look at Android-screenshot-library, enables to programmatically capture screenshots from Android devices without requirement of having root access privileges.
Android take screenshot from code, with root access

Android take screenshot from code, with root access

By : Suguru Wakita
Date : March 29 2020, 07:55 AM
Does that help Well, seems I'm on my own with this one. So far this is what I've found, for those who have a similar problem. Note that this varies by version, and I am running 2.3 Gingerbread.
I found 2 files in /system/bin - screencap and screenshot.
How to take a screenshot app foreground android

How to take a screenshot app foreground android

By : Anatoly Tikhonov
Date : March 29 2020, 07:55 AM
seems to work fine Here is the code that allowed my screenshot to be stored on sd card and used later for whatever your needs are, set to background for example:
First, add proper permission to save file:
code :
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
private void takeScreenshot() {
    Date now = new Date();
    android.text.format.DateFormat.format("yyyy-MM-dd_hh:mm:ss", now);

    try {
        // image naming and path  to include sd card  appending name you choose for file
        String mPath = Environment.getExternalStorageDirectory().toString() + "/" + now + ".jpg";

        // create bitmap screen capture
        View v1 = getWindow().getDecorView().getRootView();
        Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache());

        File imageFile = new File(mPath);

        FileOutputStream outputStream = new FileOutputStream(imageFile);
        int quality = 100;
        bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);

    } catch (Throwable e) {
        // Several error may come out with file handling or OOM
private void openScreenshot(File imageFile) {
    Intent intent = new Intent();
    Uri uri = Uri.fromFile(imageFile);
    intent.setDataAndType(uri, "image/*");
<?xml version="1.0" encoding="utf-8"?>
  <style name="Theme.Transparent" parent="android:Theme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:backgroundDimEnabled">false</item>
<activity android:name=".SampleActivity" android:theme="@style/Theme.Transparent">
How to programmatically take a screenshot in Android without root or adb?

How to programmatically take a screenshot in Android without root or adb?

By : Danna Frivaldo
Date : March 29 2020, 07:55 AM
this will help On Android 5.0+, use the media projection APIs. They are somewhat under-documented. This sample project demonstrates how to take screenshots.
On Android 4.4 and lower, this is not possible, outside of perhaps some security flaws on specific device models.
Take screenshot of current foreground application

Take screenshot of current foreground application

By : Anella Lingo
Date : March 29 2020, 07:55 AM
it should still fix some issue No.
There's a reason the code always takes a screenshot of your application: it's your application.
Related Posts Related Posts :
  • FastAdapter: Undo button does not show up after swipe
  • What are reasons to pass getActivity as the LifecycleOwner to the LiveData's observe method in a fragment?
  • Implement Face Recognition in Android
  • Titanium studio cannot run "titanium" command in terminal
  • How to execute command line ffmpeg commands programatically in android?
  • Make Android List Items clickable with each item pointing to a different link
  • listview runs successfully, but nothing is display in emulator
  • How to zoom in a bitmap with high resolution?
  • Passing listView data through intent
  • Google map route direction show by arrows in android v2
  • how to start "uiautomator test run" from android code?
  • Proguard in Android Library
  • Alarm Clock from GIT - Gives error - Android
  • Mock injection using Mockito - Android
  • Get Bitmap from universal image loader
  • Unable to include custom font in android
  • Basics on using logcat in Android development
  • Android: Clear cache programmatically
  • Android: pass object without serialization
  • Can not scroll and click item on gridview inside scrollview
  • Android device keeps disconnecting from adb / eclipse
  • Volley cannot create cache directory. Could not clean up file
  • ShareActionProvider icon in actionbar
  • How to open a custom attachment using an Android app?
  • Unable to add column dynamically into the sqlite table
  • android persistence activity which never stop
  • The Google Play services resources were not found. Check your project configuration to ensure that the resources are inc
  • How to select files from google drive in android?
  • Run a AsyncTask every 10 seconds until cancelled
  • Blur on touch. Android application
  • NDK Android - Can't build ARMv5 and V7 at the same time
  • Android development with Eclipse clean and build
  • How to set Different Key Background for every Key in Android Custom Keyboard
  • Face recognition using OpenCV in android?
  • Tumblr API - Jumblr for Android [OAuthConnectionException]
  • Small Icon on Notification not working correctly
  • ConstraintLayout match parent height on larger screens but scroll on smaller
  • Kotlin version issue
  • How can i make my android app look the same on RTL and LTR languages?
  • Can not detect Android NDK toolchain
  • Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only.
  • Facebook Key Hash for Play Store Release
  • backbutton confirm exit app android + phonegap + jquery
  • How to Make Instagram Listview in android?
  • Up and Down Enemy Movement using translate corona sdk
  • Set selection method is not working in gallery in android
  • How to implement onOptionsItemSelected for Sub-Menu Items?
  • HttpHostConnectException connection refused ConnectException ErrnoException
  • Adding Buttons to expendableListView as last Child
  • Android. Block phone on startup
  • How to programmatically check If string is not to wide to fit onto the screen in Android
  • EditText box cursor appear after touching box?
  • using if statement when video is done playing
  • Add to Aspectpath not found MonkeyTalk
  • GooglePlusUtil cannot be resolved (Android)
  • Trouble understanding Relative Layout
  • How to title/name each fragment separately to appear on PagerTitleStrip?
  • Android webView blinks
  • Available service types in WifiP2pDnsSdServiceInfo.newInstance
  • Hide only bottom action bar Android
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org