Is there any way to get the text content that is being displayed on the android mobile screen. It may be by any android app.
for example in the image linked above, i wish to get all the text (starting from the "Larry Page" till the end "Fred Smith" and also the position of all the words on the screen) that is in the image and its respective position on the screen.
This can be achieved using the Accessibility feature of Android (as the Universal copy app does).
What you need to do is implement a class called AccessabilityService which can access all the screen UI through a listener.
In order to that you need to declare it in the manifest:
the file @xml/accessibilityservice is where you configure the service like to which package to listen or what kind of events you want to get:
In the class override the method:
In that method, you should find in the UI the desired text/TextView/EditText and extract from it the text you want.
NOTE: this way required the Accessibility permission which only the user can give you and it cannot be done in runtime.
You can read more in the Android documentation about how to implement an AccessabilityService
EDIT: after the question in the comment I'm adding the code to read from all the text components in the screen:
Just don't forget to initialize the AccessibilityNodeInfo and the depth counter like so: