Create Your First App (Fire Tablets)
This topic shows you how to use Android Studio to create a Hello Fire app. For more information about how to create your first Android app, see the Build your first Android app tutorial in the Android documentation.
- Create Your App in Android Studio
Before you begin, you must have already set up your development environment. For more information, see Setting Up Your Development Environment for Fire Tablets.
Create Your App in Android Studio
To create a Hello Fire app, you first need to create a new project in your IDE. Use the following steps to create a new project in Android Studio:
- Open Android Studio.
- Click New Project.
- In the New Project window, select Fullscreen Activity and click Next.
- In the New Project details window, in the Name box type HelloFire.
- From the Language dropdown, select Java and then click Finish.
By default, Android Studio displays your app structure in the project view pane. To view all of your projects, click the project dropdown at the top of the view and select Project.
A Brief Overview of Android Apps
To help you better understand the next steps for our Hello Fire app, the following introduces a few basic concepts about Android apps.
In our Hello Fire app, there are three primary components:
- MainActivity.java - This is the core logic specific to the app. It is also typical Java code for an Android activity. In the Fullcreen Activity app template, this file is located in the app>src>main>java>com.example.hellofire folder.
- activity_main.xml - In Android applications, a recommended convention is to lay out all user interface (UI) elements in a dedicated XML file. For this example, we use the dedicated XML file activity_main_fire.xml (from the res/layout subdirectory of the project) to define the layout for our activity. Doing so simplifies the UI design, so that making changes does not require digging through core logic. The creation of class R includes this dedicated XML file, and the core logic can reference R to manipulate the UI elements. Instead of laying out UI elements in a dedicated XML file, you can define the UI elements inline with the code as with any other Java application. In the Fullcreen Activity app template, this file is located in the app>src>main>res>layout folder.
- strings.xml - Another convention in Android applications is to put string values of UI elements such as labels in a dedicated XML file. This practice is equivalent to using a Java resource file that provides a path to localize UI elements. This makes it easier to find strings in your application without having to dig through the code. This dedicated XML file, located in the res/values subdirectory, holds key-value mappings. The key identifies the UI element in the layout, and the value is the string that appears when the application runs. In the Fullcreen Activity app template, this file is located in the app>src>main>res>value folder.
Customizing Hello Fire
To edit the Hello message in the app:
- Under the HelloFire project, open the app>src>res>values folder.
- Open the strings.xml file.
- Change the dummy_content string to
- Android Studio automatically saves your changes to the strings.xml file.
You are now ready to run your Hello Fire app. For information about configuring your Fire tablet to run your app, see Connect to Fire Tablet through ADB (Fire Tablets).
Last updated: Nov 09, 2022