Taking a screenshot of  Android phone’s screen can be a bit confusing, since the process isn’t the same on every device. In this example we will discuss how to take the screenshot of Android device  screen and write it to the sd card programatically. Code for MainActivity.java: Code for corresponding layout: code for activity_main.xml: Add this