Press enter to see results or esc to cancel.

Create Your First Android App with Android Studio: java

Share this
()

Before going into the study of the characteristics of Android Studio, it is appropriate to try to create your first Android App with Android Studio, in order to verify that the installation of the development environment is successful. The first approach to this tool can sometimes be less friendly than expected.

First Android App with Android Studio

The first step is to create a new project, After launching Android Studio, as we have seen, the welcome window appears:

android studio welcome window
android studio welcome window

By clicking on the Start a new Android Studio project item, the first screen of the wizard for creating a new project appears

Android studio choose your project Template
Android studio choose your project Template

Here, we must indicate the type of devices on which our application will be installed, then select the “Phone and Tablet” option, then we gonna choose the initial activity of our application. Various types of activities are available but for the purpose of this lesson, we choose the “Empty Activity” option and click on Next

 

Android studio: create new project overview
Android studio: create new project overview

Project Name

In this window, we insert the Name of the application (coding180 Android Practise 1), which will be the one with which it will be identified within Android Studio and also on the Google Play Store.

Package Name

Next is to specify the Package name – It serves as a unique URL to your app, It identifies your app in the device and in Google play store. (Automatically set by Android studio)

Save Location

Next is to choose the save location – It allows you to choose a location to save your project files, locally. (Automatically set by Android studio).

Language

The next step is to select the Programming Language to use for your android app development, It could be either Java or Kotlin. (For the purpose of our lesson, you leave it at Java).

Minimum API

This option lets you select the minimum version of android you want your App to support. we choose Android 4.0 (IceCream Sandwich).

We deliberately choose a fairly dated version of Android (Android 4.0) to ensure that the application we release will work on as many devices as possible. In fact the higher the “Minimum API” of the application, the smaller the number of devices on which it can be used. Clicking on the Help me choose link shows a useful graphic that explains the meaning of this choice better.

Android api distribution
Android API distribution

In general, it is appropriate to select a minimum version of the higher SDK when an application requires specific features not contained in previous versions of the SDK, which must, therefore, be excluded by setting a higher level.

After choosing the name of the activity we can finally click on Finish. At this point, Android Studio will start creating our project.

Topic: Lesson 6 – Create Your First Android App with Android Studio

In practice, Android Studio creates the project files and opens it. The project itself, and the associated files, are displayed in the Project window to the left of our Android Studio work environment. In this window, the information can be displayed in different ways (by default the Android mode is selected, but if you want you can also select a different one, depending on your preferences).

Android studio Project window
Android studio Project window

In this phase, our project consists of a user interface (corresponding to the activity created) which contains a label set to “Hello World!”. The user interface of our application is managed in a file called activity_main.xml (the name we chose when creating the project) contained in the layout folder:

activity main xml
activity main xml

By double-clicking on this file, the design window ( User Interface Designer ) containing the view of a device in which the word “Hello World!” Is written is loaded in the center of the Android Studio main window.

Android Studio User Interface Designer
Android Studio User Interface Designer

The device displayed corresponds to a Google Pixel as can be seen in the menu located at the top of the design window. By clicking on this menu it is possible to select various other types of devices. It is also possible to change the orientation of the device using the button located immediately to the right of the menu for choosing the type of device.

android studio designer rotate

To the left of the device area there is the Palette menu which contains different categories of components that can be used to construct the user interface:

android studio disigner palette window
android studio designer palette window

One of these categories is called Layouts: It provides different types of layouts that allow different levels of control over the positioning and management of the user interface components.

When an interface is changed graphically, the contents of the corresponding XML file are changed, so in this case activity_main.xml. Vice versa, therefore, it is also possible to modify the interface by operating directly on the XML file and for this reason, in the lower part of the design window, it is possible to pass from the graphical display to the textual one simply by clicking on the Text label. In this way, the window is divided into two parts, one with the XML code and the other with the graphical interface so that changes can be viewed in real-time.

android studio xml and designer view
android studio xml and designer view

How useful was this Lesson?

Click on a star to rate it!

Average rating / 5. Vote count:

Be the first to rate this post.!

As you found this post useful...

Follow us on social media!

We are sorry that this lesson was not useful for you!

Let us improve this lesson!

Tell us how we can improve this lesson?

Share this