Home > Resources > Development Tools > IDE Setup & Tools

Creating Your First Fire Tablet App

Introduction

If you have not yet created an app for a Fire tablet, you can use Android Studio or Eclipse to create a Hello Fire app. For more information about how to create your first Android app, in the Android documentation see the tutorial.

Prerequisites

Before you begin, you must have already set up your development environment. For more information, see Setting Up Your Development Environment.

Creating 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:

  1. Open Android Studio.
  2. On the File menu, click New Project.
  3. In the New Project window, in the Application name box type HelloFire. You can choose a minimum required SDK, target SDK, and version with which to compile, but make sure that you target and compile for API 15 or later.
  4. Click Next twice.
  5. In the Activity Name box type HelloFireActivity, and then click Finish.

The Project pane now lists your project.

Project Pane showing Hello Fire

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:

  • HelloFireActivity.java - This is the core logic specific to the app. It is also typical Java code for an Android activity.
  • activity_hello_fire.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_hello_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. However, laying out UI elements in a dedicated XML file is not the only way to define and lay out UI elements. You can also define the UI elements inline with the code as with any other Java application.
  • 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.

Customizing Hello Fire

To edit the Hello message in the app:

  1. Under the HelloFire project, open the app>src>main>res folder and then the values folder.
  2. Change the hello_world string to Hello, Fire.
  3. On the File menu, click Save to save your changes to the strings.xml file.

You are now ready to run your Hello Fire app.

Creating Your App in Eclipse

Use the following steps to create a new project in Eclipse:

  1. Open Eclipse.
  2. On the File menu, click New, and then click Project.
  3. In the New Project window, under Android, click Android Application Project, and then click Next.
  4. In the New Android Application window, in the Application Name box type HelloFire. You can choose a minimum required SDK, target SDK, and version with which to compile, but make sure that you target and compile for API 15 or later.
  5. Click Next several times until you reach the Blank Activity window.
  6. In the Blank Activity window, in the Activity Name box type HelloFireActivity, and then click Finish.

The Project Explorer pane now lists your project.

Project Explorer showing Hello Fire

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:

  • HelloFireActivity.java - This is the core logic specific to the app. It is also typical Java code for an Android activity.
  • activity_hello_fire.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_hello_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. However, laying out UI elements in a dedicated XML file is not the only way to define and lay out UI elements. You can also define the UI elements inline with the code as with any other Java application.
  • 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.

Customizing Hello Fire

To edit the Hello message in the app:

  1. Under the HelloFire project, open the res folder and then the values folder.
  2. Double-click strings.xml.
  3. Under Resources Elements, select hello_world (String), and then in the Value box enter Hello, Fire.
  4. On the File menu, click Save to save your changes to the strings.xml file.

You are now ready to run your Hello Fire app.

Next Steps

To set up your Fire tablet to run and test your app, see Connecting Your Fire Tablet for Testing.