How to Import Sample ApiDemos into Android Studio 1.5.1 - android

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?

You can download an archive of ApiDemos directly from here.
https://android.googlesource.com/platform/development/+/master/samples/ApiDemos
Not sure if there is a direct git link, because as you can see, it is under the sample directory of the platform/development repository.
You are more than welcome to clone the whole 300+ MB of the android-development repository and get access to ApiDemos (and much more) like so
$ git clone https://android.googlesource.com/platform/development android-development
$ cd android-development/samples/ApiDemos

There is no samples folder under android sdk for Android Studio 2.1.2. I ended up getting API folders from the link provided by #cricket_007. Also, don't waste time looking for the Fragment sample code in https://github.com/googlesamples because its not there. It only has the latest sample codes.

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

Related

Best way of version control, stable builds and exporting/ a project on multiple devices

today it's a shorter question I'd like to ask, to hear your opinions as I suppose some do this differently than others.
First of all,, I have an Android Studio project and am rather a novice on this subject of Android Development. That's why slight changes in the java or xml files could and did make my latest app unstable/ crashing.
Therefore I was asking myself wether Android Studio offers a way to backup stable builds - I could imagine this like a save-as option where you backup the working version and continue working on the the one but have a stable one backed up.
I know there's the export project function but I tried it out a couple of times and having worked on a project on the same device before, prior to reimporting a project causes an error and that's not the way I guess you should handle it in this situation.
I was looking at Google Cloud for using both version control and the option to commit new versions to the trunk and update them at a different location (different device). If that's the solution you propose, I need to look more closely into the documentation to get it up and running (set up the repository already but no clue how to commit changes/ versions).
So, long story short, what tool/ option do you prefer to have an export and a version control option unified for Android Studio?
Interested to hear and thankful for any advice on that!
There are multiple solutions,
Just find your solution/project in your file explorer and back it up, if you need it again just open the project with Android Studio. (not the most popular one)
Use a version control system like git. Link to tutorial (This is the most popular one), If u are unfamiliar with git, just google it and there are tons of examples and documentation. With git you can tag commits and after u mess up revert to the tagged commit
Git is the simpliest.
It's supported by AndroidStudio and later on you can upload your project to GitHub to access it from anywhere.
You can use it with terminal and shorcut keys, incons as well.
You also can make separate branches in order to make and test more versions parallely.
For more info take a look at: https://git-scm.com/about
and of course github: https://github.com/
Regards,
Cs

Whatever happened to Google Android samples linked in their tutorials?

I seem not to be able to find any of the Google Android samples. For example, I'm reading this: https://developer.android.com/guide/topics/graphics/prop-animation.html#keyframes, and there is a link to a MultiPropertyAnimation sample which should show how to use keyframes. When I click there, it get redirected to a samples main page, and the sample I'm looking for is not there, or at least I can't find it. The same for quit a few other samples. I also tried importing the samples in Android Studio, which provides a search/filtering interface, and can't find anything there.
Has Google moved the samples, and forgotten to update the rest of the docs? Did the 'old' samples get deprecated and moved elsewhere? Can they still be accessed?
The latest (and most convenient way) to do it is:
open android studio
if a project is currently opened, close it (file -> close project)
on the following screen choose "Import an Android code sample".
Also see http://developer.android.com/samples/index.html

LibGDX won't upload libraries and create project (Windows 8)

I have the next issue. Searched in the web but have not found if someone else has the same problem.
I've downloaded stable release version of LibGDX from official website.
For some reasons when I launch it and click to create project it shows me only one choice to download LibGDX library (in the required row). It does not offer me to download any of Third-party libraries like "Physics Body Editor loader" or "Universal Tween Engine". And even if I click to download stable or nightly version of LibGDX library, program does not manage that. (Image applied on the link below)!
https://www.dropbox.com/s/144mnevk8rh883p/Untitled.png
Probably I am following this guide on how to create android game. http://www.kilobolt.com/day-2-setting-up-libgdx.html And there is no such an issue as I have. I was working previously on projects using Intellij Idea and Eclipse for Android. So I certainly have installed SDK manager and JDK on my computer. I have no idea why LibGDX won't update libraries and even won't allow me to create project.
I will very appreciate for your help! Thank you!
LibGDX requires to change Name, Package, Game Class and Destination of your Projects first. After completing these steps, all libraries will be downloaded like a charm.
Another thing is that for the first time Third-Party libraries may not appear (for example Tween Engine). But for the second project they appeared for me.
I spent about 2hrs with same issue.
This works finally:
Copy gdx-setup-ui.jar to any drive/folder (I placed it in D: drive)
Open command prompt (Start -> search: cmd)
type D: after C:\Users\xyz> ...enter
D:>gdx-setup-ui.jar ....enter
Now enter your name,package name... rest details
Then download libGDX, Universal Engine, Physics Body Editor loader.
Open Generation Screen -> Launch
DONE

How does android source code work?

I have download a set of android source code, which has folders such as "bionic, bootable, build, dalvik, development, frameworks, hadware, packages, prebuilt" and so on. When I browse the whole code, wonder how "import android.preference.PreferenceActivity;" works in Settings.java(D:\android-srce\Google-source\packages\apps\Settings\src\com\android\settings\Settings.java). I guess there is a android.jar file somewhere after compilation. But how does Settings.java import PreferenceActivity correctly?? I'm a beginner in Android, please help me.
Sounds like you have downloaded the source code to the Android OS. If you want to build your own ROMS then you need to study about building the OS for a particular hardware platform. This is not trivial.
If you want to build an Android app that runs on an Android device then you want to download the SDK instead - start at Android SDK and follow your nose, buy a book, read the sample code.
There is not a lot of information how to change parts of Android. However, you can read information that is connected with the aosp tag. The first cite is source.android.com After the installation of android build system you can see video from marakana group. You'll find a lot of valuable information there.

What are Steps to grab the samples from AndEngine Repository

I had tried to grab the samples of AndEngine using Mercurial eclipse plugins, but that was firing some sort of error to me again and again. So, can someone please let me know what could be the easiest way to get the AndEngine examples or samples from the repository. I am working on Windows.
Thanks.
Update:
Change the Mercurial client from the built in one to TortoiseHG (in the Eclipse preferences).
Previous Answer:
Plan A: Make sure to use native Mercurial with EclipseHG (not the one which ships with the plugin). You can find the settings the preferences dialog. Last time I tried, the built-in version was broken. If it fails again, copy and paste the error message.
Plan B: Try TortoiseHG
Plan C: Give us a concrete error message. (Which should actually be Plan A ;) )
You download the zip from https://github.com/nicolasgramlich/AndEngineExamples

Categories

Resources