2

Android allows to capture a full screen into an image or a video, using the MediaProjection class (shown here for example for images).

I was wondering how far can we go with this :

  1. Is it possible to capture only a specific area of the screen?

  2. Is it possible to capture an image of a specific view of another app ?

  3. Is it possible to get the bitmap of an ImageView of another app (the one that's saved using setImageBitmap, for example) ?

android developer
  • 114,585
  • 152
  • 739
  • 1,270

1 Answers1

0

No, no and no. This API basically gives you access to a copy of the hardware screen buffer. You can manipulate its contents, but you get only a full screen bitmap. There's no way to get any specific view or a class from another app. I imagine that that would be a major security flaw it it was possible.

Zielony
  • 16,239
  • 6
  • 34
  • 39
  • Why security flaw, if the user confirms it and sees an icon showing that it's active, and, I ask for a part of the screen, while the current API takes an image of the entire screen. There is no difference of security issues here.... Besides, this might help with UI automation (for power users and developers) and for accessibility (disabled people in various things). – android developer Jan 09 '17 at 06:28
  • Hi android developer, have you found the solution? If yes, then please share it. – abhishek kumar gupta May 29 '17 at 14:08