title: Take a screenshot on Android
body: <p>I'm trying to build a custom launcher for android that needs to take a screenshot of the device right after the user presses the home button and consequently right before my app (the launcher) goes back to the foreground. Pretty much the idea is to take a screenshot of whatever the device was showing right before my launcher/activity/app took over the screen.</p>
  
  <p>I am aware that such a thing requires root access, but that's not a problem. Can anyone show me how to take screenshots? Some sample code? A tutorial online? I have looked online but couldn't find anything useful. I'm trying to simply take screenshots just like a gazillion apps on the Android Market already do with root access. Thanks in advance :-)</p>