How to run those Android SDK example applications?
I have 64-bit Windows 7 Professional, Android SDK and ADT Plugin for Eclipse. In the开发者_C百科 examples directory of Android SDK there are at least three different directories for SoftKeyboard. Which one should I use?
How to run that SoftKeyboard? I tried, but it didn't work at all.
You can find it from here, too: http://developer.android.com/resources/samples/SoftKeyboard/index.html
These can be imported as an existing project into your eclipse workspace.
You can find the project files in the ANDROID_SDK\samples\android-XX\SoftKeyboard
folder (where XX is a certain api level).
To import them inside eclipse, go to File -> New -> Other -> Android Project
. Then select create project from existing source
and select the folder above as the location. Pick the appropriate API level below if none is selected and press finish. And thats it, you got yourself a shiny new android project that you can run like every other one.
Keep in mind that all api samples come preinstalled in every emulator. So if you want to test this in a emulator, you have to uninstall the preinstalled version first. Either run adb uninstall com.example.android.softkeyboard
from the command line of your OS or uninstall the examples via Preferences -> Applications
in the emulator itself.
The different versions in the folder are for the different API levels (What is an API level?) of android. That just means they are written to support that api level and above. Depending on what has changed between the versions, there might be no difference at all between the files.
There are different examples of the same project because you have multiple SDK's installed for several versions of Android. Each SDK directory contains the example. I would say just load the one for whichever version of Android you want to target.
To load the project from an existing example in Eclipse: Click on File -> New -> Project and select Android Project -> Click Next. Select "Create project from existing source" and click Browse to find the directory containing the example you want to load. Finally just click Finish.
That should load the example into your workspace.
here is a tutorial which guides you through the steps of running the sample apps:
Running Android SDK samples
You should use the version which fits to your Android Version. Because the SoftKeyBoard isn't an anctivity (it is a service) you have to call the service by your own application in order to test it.
精彩评论