Reputation: 535
Is there any way that I can redraw the views that are showing in current window dynamically. So basically I want to dynamically redraw what is currently showing on screen on a another screen.
For this I want views that are currently displaying and hierarchy of them
I have tried hierarchyviewer. By this I am able to get the view hierarchy for my debug app but not for production apps.
I have also tried AccessibilityService using which I can get AccessibilityNodeInfo tree for all the nodes of current window but I can't get the actual view.
Can anyone help me on this.
Upvotes: 0
Views: 646
Reputation: 1006914
Is there any way that I can redraw the views that are showing in current window dynamically
You cannot even get the views, unless it is your own content. For example, given any View
in your Activity
, you can traverse up the parent chain to the root View
, then fan out from there. But you cannot get a View
object from another app.
I want to dynamically redraw what is currently showing on screen on a another screen
You are welcome to use the media projection APIs on Android 5.0+. These do not give you the view hierarchy, but do give you access to screenshots of the current screen content, with user permission.
I have also tried AccessibilityService using which I can get AccessibilityNodeInfo tree for all the nodes of current window but I can't get the actual view.
That is because the View
objects are in another process.
Upvotes: 3