How can I copy/pate multibyte characters on Android Emulator?

荒凉一梦 提交于 2019-12-14 04:10:20

问题


I got to know how to copy/paste from command line tool at Paste text on Android Emulator

adb shell input keyboard text 'foo'

It works very well for ascii characters but it doesn't for multibyte characters.

adb shell input keyboard text 'あ'

Doesn't pass any character to emulator.

adb shell input keyboard text '\u3042'

Shows '\u3042' as it is.

Is there any way to pass multibyte characters to the emulator from command line correctly?


回答1:


I think there is no way to do what you want.

Digging in the sources, the input command line tool ends up calling KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD), and uses that KeyCharacterMap to map from characters to keys press / release events.

Since KeyCharacterMap.VIRTUAL_KEYBOARD does not cover the whole Unicode range, it is not possible to generate events for a lot of characters.




回答2:


The latest Android Emulator (v25.3) can support copying & pasting multibyte characters. This was launched with Android Studio 2.3. Take a look at the screen recording of the behavior below...



来源:https://stackoverflow.com/questions/28914059/how-can-i-copy-pate-multibyte-characters-on-android-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!