Paste text on Android Emulator

后端 未结 20 1435
臣服心动
臣服心动 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:32

    Just click the left mouse button for 2 or 3 seconds, paste button will be appear. Click the paste button and the test will be copied smoothly.

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

    I came here looking for a solution to the same problem, and ended up writing an Android application to solve this problem. You can download it at http://www.box.net/shared/6203bn441bfltkimajmk. Just give a URL via Preferences menu to point to a place where you can change the Web response easily. The first line of the Web response will be copied to your emulator's clipboard for you. More details can be found at http://agilesc.barryku.com/?p=255.

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

    In a terminal, type adb shell input text 'my string here. With some characters escaped like \$ that'

    Note that an alternative method for including spaces in the text is to substitute %s for each space character.

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

    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

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

    If you are using Android Studio on a Mac, you may need to provide the full path to the adb executable. To find this path, open:

    Android Studio > Tools > Android > SDK Manager
    

    Copy the path to the SDK location. The adb executable will be within a platform-tools directory. For me, this was the path:

    ~/Library/Android/sdk/platform-tools/adb
    

    Now you can run this command:

    ~/Library/Android/sdk/platform-tools/adb shell input text 'thetextyouwanttopaste'
    
    0 讨论(0)
  • 2020-12-07 07:36

    Using Visual Studio Emulator, Here's my method.

    First Mound a virtual sd card:

    1. Use the Additional Tools (small >> icon) for the emulator and go to the SD Card tab.
    2. Select a folder on your computer to sync with the virtual SD card.
    3. Pull from SD card, which will create a folder structure on the selected folder.

    Set up a text file to transfer text:

    1. Use Google Play Store to install a text editor of your choice
    2. Create a text file containing your text on you computer in the download directory of the virtual sd card directory you created before.

    Whenever I need to send text to the clip board.

    1. Edit the text file created above.
    2. Go to Additional Tools (small >> icon) and chose Push To SD Card.
    3. Open the text file in the text editor I installed and copy the text to the clip board. (Hold down the mouse when the dialog opens, choose select all and then click the copy icon)

    Once set up it pretty easy to repeat. The same method would be applicable to other emulators by you may need to use a different method to push your text file to emulator.

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