Where can the android samples be found?

2019-04-08 03:24发布

I checked google developers website for some exercises and examples in Android Development and I found this webpage: http://developer.android.com/tools/samples/index.html which says

When the download is complete, you can find the source code for all samples at this location: /samples/android-

I didn't find that location! What should I do? And if you know a better practicing way for a beginner to learn,let me know please!

4条回答
你好瞎i
2楼-- · 2019-04-08 03:37

You will need to make sure the SDK samples are installed: enter image description here

This image is from the SDK Manager. Once you check off the samples for the APIs you want, and everything is installed, you can easily make an Eclipse project:

File -> New -> Other -> Android Sample Project

Or you can navigate directly to the path. You can see from my screenshot, that for me it is in Program Files\Android\android-sdk with the samples being in the samples subdirectory.

查看更多
爷的心禁止访问
3楼-- · 2019-04-08 03:38

On Win8: you import samples using Android SDK Manager and they are going to be in this folder (this is the folder with android-sdk):

C:\Users\YourUserName\AppData\Local\Android\sdk\samples

This worked for me

查看更多
唯我独甜
4楼-- · 2019-04-08 03:40

The latest (and most convenient way) to do it is:

  1. open android studio
  2. if a project is currently opened, close it (file -> close project)
  3. on the following screen choose "Import an Android code sample".

enter image description here

Also see http://developer.android.com/samples/index.html

查看更多
我只想做你的唯一
5楼-- · 2019-04-08 03:46

It's in the directory where you've installed the Android SDK. If you're running on Windows, it probably looks like C:\android-sdk. Inside it there's a subdirectory called samples. That's where they are. Note however, that they don't come pre-installed with the SDK, you need to actually download samples via the Android SDK first. Just launch it, check the "samples" for the android platform you want and start the download.

查看更多
登录 后发表回答