Android API like java.awt.Robot
Is there an Android API analogou开发者_如何学Cs to java.awt.Robot, i.e. an API allowing to take screenshots?
If you would like to simulate touch events (just like robot does with mouse clicks) use the utility class TouchUtils
.
java.awt.Robot is not available in the Android SDK.
If you want to make screenshots by your own during development you can use DDMS. If your application should make screenshots, I think this requires root. There are application that can do that, e.g.
http://handheld.softpedia.com/get/Others/Screenshot-Android-71410.shtml
There is also a library available that may be useful for you:
Android Screenshot Library (ASL)
However, there is also a disucssion on SO:
How to capture the android device screen content?
Robot
class is only available in Java, this is not supported in Android, Too see what are the classes supported in Android, pls click this
class TouchUtils... This class was deprecated in API level 24. Use Espresso UI testing framework instead. New tests should be written using the Android Testing Support Library.
https://developer.android.com/training/testing/ui-automator
精彩评论