'how to screenshot entire phone screen with status bar in android

I have been trying for a while now to capture a screenshot of the entire phone screen( with android status bar icons)...but am only able to capture my current activity in my app. I will appreciate if someone can help me out with java code for screenshoting the entire screen not just my current activity in my app using a button



Solution 1:[1]

pls read this code from the link. It helped me with a similar situation like yours. Screeenshot in android programmatically

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peer Mohamed