Paste text on Android Emulator

2019-01-16 00:13发布

Is there anyway to copy/paste (desktop's) clipboard content to EditView on Android Emulator?

(just for the sake to ease development/test)

17条回答
做个烂人
2楼-- · 2019-01-16 00:20

Not sure if that's useful, but, if you need a long URL from desktop browser to be opened in mobile browser, you can send SMS with that URL and open directly from message app.

enter image description here

查看更多
Ridiculous、
3楼-- · 2019-01-16 00:22

For Mac and Linux try this function in your aliases_bash file (located in /etc/aliases_bash for Mac folks, be sure to use sudo vim /etc/aliases_bash)

function adbtx {
  userinput="$(sed 's/ /%s/g' <<< $1)"
  adb shell input text "${userinput}";
}
export -f adbtx

Then in the command line enter:

adbtx 'Your text to emulator input'

'Your text to emulator input' will be input on the emulator text field.

Kudos to Eliot for his substitution string for sed.

查看更多
爷、活的狠高调
4楼-- · 2019-01-16 00:25

maybe a little bit tricky, but you could send an sms to the emulator by using the emulator control. then you do not have to retype all the text if it is longer and can copy-paste it in the emulator.

another way: connect to emulator via "telnet localhost PORT" and then use hardware event sending to send a text input event to the emulator (needs to be UTF-8). look at this

查看更多
SAY GOODBYE
5楼-- · 2019-01-16 00:28

Just copy from wherever, click and hold on the emulator phone's edit text where you want the text to go (kind of like you would press and hold to paste on an actual phone), the PASTE option will appear, then PASTE.

查看更多
祖国的老花朵
6楼-- · 2019-01-16 00:31

On Linux this will paste text directly from the clipboard

adb shell input text "'$(xclip -selection c -o)'"

Also it very useful to create global keyboard shortkey with this command for example Ctrl+Shift+Super+V

查看更多
Luminary・发光体
7楼-- · 2019-01-16 00:31

(converting comment discussion to answer)

only solution on windows: https://github.com/gcb/AdbPaste

wrote it in a couple hours to work around this problem. I am now back on 100% linux, so feel free to join it as a contributor or maintainer!

查看更多
登录 后发表回答