i'm new to Android Programming and now following official android training here
i'm actually confused since courses are different from what i get in Android Studio 1.4.1, and i have some questions :
- where can i get back the standard 'blank activity' instead of that new one with floating button ? and,
- why there are two XML layout definitions for each created activity ?
thank you
1 Answer
There is a Template called 'Empty Activity' in 'Create New Project' dialog. It seems to be equivalent to the former 'Blank Activity'.
And it has a single layout.xml.
Note that it is not explicitly equivalent to the former 'Blank Activity' because it is gotten rid of any Menus. However, I think it is suitable for your tutorial purpose for its simplicity.
Besides Floating Button, the current 'Blank Activity' has an ActionBar (implemented with Toolbar) and nested layout (using inclusion). It may look quite complex for newbies.
How can I get the actual layout ... ?
You can get the 'Blank Activity' template's actual layout by including content_main.xml into activity_main.xml. The structure is below:
In which I can add some TextViews?
It is the RalativeLayout shown above. Set an id to the RelativeLayout and find it.
In content_main.xml (set id):
In onCreate (find it):
And add your textView to the relativeLayout instead of setting it as the contentView.
Not the answer you're looking for? Browse other questions tagged androidandroid-studio or ask your own question.
Downloading the Android Studio Project Folder
The FTC SDK can be downloaded from a GitHub repository. GitHub is a web-based version control company that lets individuals and organizations host content online. In order to access the FTC software, you will need to have a GitHub account. You can create one for free by visiting the GitHub website:
Once you have created a GitHub account, you can visit the FTC public repository for the FTC software:
Important note for advanced GitHub users: this tutorial assumes that the user is a novice with respect to using GitHub and the git version control software. If you are a GitHub power user, you can use git to create a local copy of the ftc_app repository. This document, however, does not explain how to use git to access the repository. It provides instructions on downloading the repository as a .ZIP file instead.
From the main repository web page, click on the “releases” link to jump to the Releases page for the repository. The Releases page should list the available software releases for the repository. The latest release should be displayed near the top of the page.
Each software release should include a Downloads section that you can use to download the software that you will need to program your robot.
Click on the Source code (zip) link to download the compressed Android Studio project folder.
Extracting the Contents of the Archived Project File
Once you have downloaded the archived (.ZIP) project file you can move this file to the location of your choice.
Before you can import the FTC project into Android Studio, you must first extract the contents of the archived project file. For Windows users, right mouse click on the file and select “Extract All” from the pop up menu. Windows should prompt you to select a destination for the extracted project folder. The dialog that appears should look similar to the one show in the figure below.
Highlight the suggested name for the destination folder (in the figure above, the suggested name is “ftc_app-2.00”) and change the destination folder name into something more user friendly. In this example, we will change the name of the destination folder to “mycopy”.
After you have renamed the destination folder, extract the contents of the archive to the folder. After the extraction process is complete, verify that the project folder was successfully extracted to its target destination.
Once you have successfully extracted the contents of the archived file, you are ready to import the FTC project into Android Studio.
Importing the FTC Project into Android Studio
In order to import the FTC Project, you will need to launch the Android Studio software on your computer. On the main Android Studio Welcome screen, select the option to “Import project (Eclipse, ADT, Gradle, etc.)” to begin the import process.
Android Studio should prompt you to select the project folder that you would like to import. Use the file browser in the pop up dialog box to locate and then select the folder that you extracted in an section of this document. Make sure you select the extracted project folder (and not the .ZIP file which might have a similar name to the extracted folder). Hit the “OK” button to import the selected project into Android Studio.
In the figure above the project folder called “ftc_app-2.00” is selected to be imported into Android Studio. It might take Android Studio several minutes to import the project. Once the project has been successfully imported, the screen should look similar to the one depicted in the image below.