0

I already made a button to be overlaid in the system window, only thing is I don't know how to take screenshot programmatically from that button to take screenshot of home screen or any other screen (not my activity).

What I want is how to programmatically run the combo keys to initiate the screenshot? (like pressing both power and volume down key at the same to take screenshot)

I know using adb command required root (which I don't want to), you can using getrootview but only inside your own activity (which I don't want to).

vims liu
  • 643
  • 1
  • 9
  • 20
  • 3
    Possible duplicate of [how to take snapshot of screen programmatically?](http://stackoverflow.com/questions/5973974/how-to-take-snapshot-of-screen-programmatically) and http://stackoverflow.com/questions/2661536/how-to-programmatically-take-a-screenshot-in-android – px06 Sep 09 '16 at 08:18
  • Hi the second link is the way I don't want which is taking screen shot only inside your activity, but I also want to take screenshot of home screen, other app screen. I don't want use of 3rd library but will take a look at the first link – vims liu Sep 09 '16 at 08:22

1 Answers1

0

Since Android Lollipop (5.0) you can use MediaProjection to take screenshot.

TOP
  • 2,574
  • 5
  • 35
  • 60
  • must be able to do it from api level 16 (4.1) because I currently only have 4.1 version of android device – vims liu Sep 09 '16 at 08:37