Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am trying to get Screen shot of device in android, I used below code to take screen shot, it works for image and widget but When video is running and trying get screen shot of it, it gives below error. How can I solve this problem and I get screenshot of playing video on screen

Do partial code cache collection, code=26KB, data=30KB
    After code cache collection, code=26KB, data=30KB
    Increasing code cache capacity to 128KB
   Bitmap image = Utils.screenShot(activity.getWindow().getDecorView().getRootView());
   image = Utils.getResizedBitmap(image, 500);
    public static Bitmap screenShot(View view) {
        Bitmap bitmap = Bitmap.createBitmap(view.getWidth(),
                view.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        view.draw(canvas);
        return bitmap;
                Logcat is above, When picture runs on screen it gives screenshot of it but When play video suddenly app is closed and it gives at above info
– Diego
                Aug 4, 2020 at 13:40
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.