Skip to content

Instantly share code, notes, and snippets.

@nitink133
Last active April 14, 2018 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitink133/15627b6b800b73db6e8eaa6cf7e0dc7e to your computer and use it in GitHub Desktop.
Save nitink133/15627b6b800b73db6e8eaa6cf7e0dc7e to your computer and use it in GitHub Desktop.
Automatic Screenshots capturing tool for android
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
class Screenshots {
public static void main(String args[]) {
BufferedReader bufferedReader = null;
Scanner scanner=new Scanner(System.in);
int pageno=1;
try {
int n=scanner.nextInt();
while(pageno<n){
System.out.println("Wait...");
// Runtime.getRuntime().exec("adb exec-out screencap -p > " +pageno+".png");
// Runtime.getRuntime().exec("adb shell input swipe 300 700 50 700");
Process p1=new ProcessBuilder(new String[]{"cmd.exe","/c","adb exec-out screencap -p >" +pageno+".png"}).start();
Process p2=new ProcessBuilder(new String[] {"cmd.exe","/c"," adb shell input swipe 300 700 50 700"}).start();
p1.waitFor();
p2.waitFor();
pageno++;
}
} catch (Exception e) {
System.out.println("Error");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment