Paste text on Android Emulator

后端 未结 20 1433
臣服心动
臣服心动 2020-12-07 07:10

Is there an easy way to copy/paste (desktop\'s) clipboard content to EditView on Android Emulator?

(just for the sake to ease development/test)

相关标签:
20条回答
  • 2020-12-07 07:23

    Have you looked at C2DM? chrome2phone and fox2phone can send links and clipboard text and automatically copy it on the phone. Also, try using the adb shell. There's a service command (/system/bin/service) which can use services (service call clipboard ...). The transaction codes are 1, 2, and 3, for getClipboardText, setClipboardText, and hasClipboardText respectively.

    0 讨论(0)
  • 2020-12-07 07:23

    Made this Windows application that allows users to copy paste to Android emulators or connected devices from a visual interface. https://github.com/Florin-Birgu/Android-Copy-Paste

    0 讨论(0)
  • 2020-12-07 07:24

    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

    0 讨论(0)
  • 2020-12-07 07:28

    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.

    0 讨论(0)
  • 2020-12-07 07:28

    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.

    0 讨论(0)
  • 2020-12-07 07:31

    With v25.3.x of the Android Emulator & x86 Google API Emulator system images API Level 19 (Android 4.4 - Kitkat) and higher, you can simply copy and paste from your desktop with your mouse or keyboard.

    This feature was announced with Android Studio 2.3

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