Android API like java.awt.Robot

前端 未结 4 1276
青春惊慌失措
青春惊慌失措 2020-12-19 01:51

Is there an Android API analogous to java.awt.Robot, i.e. an API allowing to take screenshots?

相关标签:
4条回答
  • 2020-12-19 02:22

    If you would like to simulate touch events (just like robot does with mouse clicks) use the utility class TouchUtils.

    0 讨论(0)
  • 2020-12-19 02:24

    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

    0 讨论(0)
  • 2020-12-19 02:28

    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

    0 讨论(0)
  • 2020-12-19 02:38

    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?

    0 讨论(0)
提交回复
热议问题