DSlomer64 DSlomer64 - 3 months ago 73
Android Question

How to Import Sample ApiDemos into Android Studio 1.5.1

At the end of http://developer.android.com/guide/components/fragments.html is stated "For more samples using fragments (and complete source files for this example), see the API Demos sample app available in ApiDemos (available for download from the Samples SDK component)."

However, ApiDemos is not listed anywhere among the hundreds of items when I try to

Import sample...
in AS 1.5.1. ADVANCED ApiDemos is listed, but the description says this is NOT what I seek.

It sure would be nice to accomplish this task in one step as advertised instead of having to download each individual file (and worry if the app will work because of some omission) from https://github.com/googlesamples/android-ads/tree/master/APIDemo.

Is there a way to
Import sample...
ApiDemos somehow?

Answer

A reasonable place to find help with Fragment is on one's own computer:

...\AppData\Local\Android\sdk\samples\android-17\ApiDemos\src\com\example\android\apis\app

A search for ArticleReaderFragment (a Fragment in the tutorial) in the parent folder C:\Users\Dov\AppData\Local\Android\sdk\samples\android-17\ApiDemos turned up nothing, so the sample code in question isn't there, but lots of Fragment*.java files could be profitable in one's self-education on the topic.

enter image description here

While not stored with any app, lots of xml files can be found here:

...\AppData\Local\Android\sdk\samples\android-17\ApiDemos\res

FragmentLayout.java is reasonably close to the app in the tutorial.

Comments