Search code examples
androidscreenshot

Android screen shot


I wanted to take screen shots from the android screen with a floating button. I made the floating button and it takes screen shots and everything works well but there are two questions 1. How can my app take screenshot in a way that the floating button gets hidden then appears after the screen shot has been taken in order not to bother the user 2. When you press the volume down and power key to take screenshot, it has a great animation. How can i add that animation?


Solution

  • Get your button's view, and just before taking the screenshot, hide it and unhide it after you are done taking the screenshot in the floating button's onClick method.

    findViewById(R.id.floating_button).setVisibility(View.INVISIBLE);
    // Take screenshot here
    findViewById(R.id.floating_button).setVisibility(View.VISIBLE);