How to get an instance of android.app.UiAutomation
android, android-5.0-lollipop, android-uiautomator, ui-automation
Solution
Just to clarify, the UiAutomation class is not part of UiAutomator (although they have similar names).
You can obtain a UiAutomation instance by calling Instrumentation#getUiAutomation(). This only works if you're running an Instrumentation-based test.
If this is part of a shell-based UiAutomator test, then you can use Runtime#exec() to execute a shell command.
Problem
I am testing some new features of Android 5.0, and now is the round of the `UiAutomator` and the new method implemented. I've tried to search for an example/guide, then I've tried to get an instance of UiAutomator by ``` getSystemService() ``` but that was not helpful. My goal is to use `executeShellCommands(String str)`. Has anyone already implemented?