Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I need to paste text into the Android emulator for testing. I'm running Android 1.6 on the emulator on Mac OS 10.6. Any idea if this is possible?

share|improve this question
    
This is a programming question which is not really for AE. Take a look at this post on meta and please read the FAQ –  Daniel Mar 15 '11 at 6:20
3  
@Daniel: Even though the emulator is usually used by programmers, questions about using emulator as a user (as opposed to using the emulator as a developer) is on-topic here as well, see: meta.android.stackexchange.com/questions/199/… meta.android.stackexchange.com/questions/299/… –  Lie Ryan Mar 15 '11 at 9:22
    
@Lie Ryan Thanks for the clarification. He did say it was for "testing" and based on that I thought he meant testing as a developer not testing as a user. Especially since he is emulating 1.6. I could be wrong though :) –  Daniel Mar 15 '11 at 16:59
add comment

6 Answers 6

Not sure if it is possible as I do not work with or use an Android emulator. What you can do however is place the text you want to copy in a text file and push it to the emulator. Once there, open it and copy the contents that way.

share|improve this answer
add comment

If you're testing on >= 2.2 emulator, then you should be able to use chrometophone or foxtophone to send text into the clipboard.

share|improve this answer
add comment

What a pain, I know... same thing on Windows, Linux, etc. too I think...

My solution... (after a little bit of preliminary set up, but after that it's very fast to use every time after that for the most part) - Really wish I didn't have to do all this setup in the first place and "it just worked" like the iPhone/iPad iOS simulator does with this kind of stuff, but (grumble, grumble...)

I run the free version of the Abyss web server (starts up in about 1 second on a fast computer) on my Mac. I'm usually running it anyway as a test server and if it's not running, like I said its starts up in about a split second and it has extremely low overhead on CPU, memory, etc. - It's also nice that you can see that it's running in your Dock so you notice to shut it off when you don't need it.

BTW, I you can also do this with the built-in Apache web server (sudo apachectl start, etc.), MAMP, etc. but I don't do that with this for a variety of my own reasons.

Anyway, within the Abyss server (inside the root htdocs directory) I keep a basic html file called "clip.html" with the proper head tags, etc. so it can display via web browsers.

I then keep the "clip.html" file open in a text editor like BBEdit and paste whatever text I want to transfer to the AVD into the "clip.html" file's body area.

I can then pull up the "clip.html" file on the AVD through my local IP address (because currently the AVD doesn't work with the "localhost" address... sigh). For example while my iOS Simulator iPhone is perfectly happy with localhost:8000/htdocs/clip.html , for Android's AVD's I have to instead quickly check to see which local DHCP IP address my computer is assigned to by my router and use that instead (CowTip: find it with Terminal: ipconfig getifaddr en1). If you move around a lot with a laptop and it changes a lot, it might be good to use a different method with an external web server with a domain name and user/pass or use some other advanced techniques I won't get into here)

Anyway, aside from all that stuff, for example, this works where I'm located right now with my Abyss web server up and running:

192.168.0.69:8000/htdocs/clip.html

I then type that URL into the Android AVD's browser URL window, go to it and save it as a bookmark for future use. As you probably already know, you'll need to config the AVD so it works with your keyboard to type it in.

From now on (as long as my internal IP address doesn't change with my location), I just click on that bookmark and there's all the text that I've pasted into the body of the "clip.html" file. If the text changes, I refresh the AVD's browser and there it is. I can of course select it and copy the text within the AVD at this point. It even works with really old Android platforms as well (if they can access an URL with the browser, it'll work!).

CowTiP: If I'm testing websites or various local URLs with the AVD's browser, etc. I can of course also add html links into the "clip.html" file that I can simply click on within the AVD's browser and go to their locations. (Not as cool, easy and quick as simply dragging an URL's favicon from your Safari browser to the iOS simulator's iPhone, etc. but that's the beauty of using Apple's stuff, isn't it?)

CowTip #2: Be sure and make the text size in the "clip.html" file large for mobile. Just do that in the CSS style in the head code of the "clip.html" file.

CowTip #3: If you change locations, be sure and update your IP address in the URL and AVM's bookmark.

I have some other proprietary methods that automate many steps above with custom scripts I wrote, but I have to charge for my time to customize it for some else's setup, sorry. But, even without the scripts, everything above works great overall.

Hopefully, some day Android will make their emulator as good as Apple makes the iOS simulator in this regard. There's other ways to do this, but I like this way the best because of its compatibility with older Android Platforms and the ability to click links, etc.

Disclaimer: I'm not responsible if you don't know how to protect your server from getting hacked, etc. with proper configuration/firewall/etc. and if your computer explodes, etc.

Regards,

Cowicide

P.S. If someone knows a better way, please share!

P.S.S. I should note you can also do this with Google Drive and set up a document, but then you're sharing your data with a third party and if they get hacked (so does your data). And there's chrometophone, but then again, you're sharing the data in the cloud with a third party with that as well. If you work with sensitive data such as classified government/corporate stuff, etc. you should use my method since all the data stays on your machine. I work with sensitive data, so I can't use those easier methods except at times when I'm working on things that aren't involving sensitive data.

share|improve this answer
add comment

If you are connected to the internet and regularly need to paste text into emulator, then one nice way would be to create a Dropbox account. Link it to a dropbox folder on your Mac. Install dropbox on your emulator and link it to your account.

Thereafter, make any text you want, put it in a text file and paste it into your dropbox folder on your Mac. Then all devices linked to your dropbox account get synced automatically. Open dropbox on your emulator and retrieve the text file.

share|improve this answer
add comment

Solution is found here:

http://stackoverflow.com/questions/3391160/paste-text-on-android-emulator

Just follow that instruction and its easy.

share|improve this answer
add comment

Or you can just email the text to yourself in gmail or something and pick it up from there.

share|improve this answer
    
The emulator doesn't come with Google apps, so that wouldn't help. And given how slow the emulator is, it would be quicker to retype almost any length of text. –  Dan Hulme Apr 30 at 22:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.