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?
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:
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.
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.
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.