August 23, 2018

Basic Android Studio Tutorial for Beginners

2018-08-23T11:15:00+05:30

This tutorial will provide you android project examples, android studio apps source code and android projects for students with source code and ultimate guide on Create a New App Project in Android Studio v 2.3.2 for beginners.

How to Create a New App Project in Android Studio v 2.3.2

Are you searching for How to Create New Project in Android Studio, how to build an Android app and how to create a new Android Studio project and application project in android studio to create Applications. Want to know about android studio project template, how to create android apps for beginners and android projects with source code.

How to build an Android app

Building an android app is tough for beginners. Creating a mobile application takes lots of patients and time. You can use the android studio project templates and android project examples in Android Studio to start with creating android applications. Developers website of Google provides android projects for students with source code. Once you have successfully installed Java SDK, then here is a quick guide on creating a new app project in Android Studiov 2.3.2.

Step 1: Create New Project in Android Studio

Open Android Studio
Close the Tip of the day box
Select File > New Project
A new window will appear titled as "Configure Your New Project". Add the below values in the box.

Application name:My Application
Company Domain: If you have a domain, type that there or just type-

com.mycompany.androidsample

You do not have to change anything else.

Select Next

Step 2: Configure the project: Add Form Factors

A new window will appear titled as "Target Android Devices". Here you need to select the form factors your app will run on different platforms that requires separate SDKs.

Tick mark the Phone and Tablet and select API 9: Android 2.3 [Gingerbread]. This willguarantee that your application will run in 100% Android Devices. If you take higher APIs, the target devices will come down and your application will have limited users.

You do not have to change anything else unless your app is intended to wearable devices, Google TV and Android Auto.

Select Next

Step 3: Add an Activity to application

Now you may get a window with SDK path like C:/Users/Admin/AppData/Local/Android/Sdk and codes in the below box.

Preparing "Install Solver for ConstraintLayout 1.0.2 (revision: 1)".
Downloading https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-solver-1.0.2.zip
"Install Solver for ConstraintLayout 1.0.2 (revision: 1)" ready.
Finishing "Install Solver for ConstraintLayout 1.0.2 (revision: 1)"
Installing Solver for ConstraintLayout 1.0.2 in C:\Users\Admin\AppData\Local\Android\Sdk\extras\m2repository\com\android\support\constraint\constraint-layout-solver\1.0.2
"Install Solver for ConstraintLayout 1.0.2 (revision: 1)" complete.
"Install Solver for ConstraintLayout 1.0.2 (revision: 1)" finished.
Preparing "Install ConstraintLayout for Android 1.0.2 (revision: 1)".
Downloading https://dl.google.com/android/repository/com.android.support.constraint-constraint-layout-1.0.2.zip
"Install ConstraintLayout for Android 1.0.2 (revision: 1)" ready.
Finishing "Install ConstraintLayout for Android 1.0.2 (revision: 1)"
Installing ConstraintLayout for Android 1.0.2 in C:\Users\Admin\AppData\Local\Android\Sdk\extras\m2repository\com\android\support\constraint\constraint-layout\1.0.2
"Install ConstraintLayout for Android 1.0.2 (revision: 1)" complete.
"Install ConstraintLayout for Android 1.0.2 (revision: 1)" finished.
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\build-tools\25.0.2\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\docs\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\emulator\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\extras\android\m2repository\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\extras\google\m2repository\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\extras\m2repository\com\android\support\constraint\constraint-layout-solver\1.0.2\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\extras\m2repository\com\android\support\constraint\constraint-layout\1.0.2\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\patcher\v4\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\platforms\android-25\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\sources\android-25\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\system-images\android-25\google_apis\x86\package.xml
Parsing C:\Users\Admin\AppData\Local\Android\Sdk\tools\package.xml

Select Next.

A new window will appear titled as "Add an activity to Mobile". You can see 12 activities listed in the window. You can select "Empty Activity" for example.

Select Next.

Step 3: Configure Your Activity

A new window will appear titled as "Create a new empty activity". Tickmark the Generate Layout file and Backwards Compatibility. Add the below values in the box.

Activity name:MainActivity
Laout name:activity_main

Select Finish

You have successfully created a New App Project in Android Studio v 2.3.2.


1 Minute Video Tutorial


Now you can try out and edit XML Command panel for coding of Android App.

App Tutorial: XML Editing Panel in Android Studio v 2.3.2

We have created a new Android Project in the last tutorial. Now let us access XML editing panel to edit the codes as it would be easier to code there than UX design panel.

OpenAndroid Studio v 2.3.2
File > Open Recent > MyApplication

The Android project file will be loaded with hello world! text. You could see an option called "Android" the project tab under myapplication.

Select Android > App > manifests > AndroidManifest.xml

On the right hand, you can see the XML editing panel with a some codes such as the one below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.admin.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
If you could see below the XML command panle, you can see two options; text and Merged Manifest. Text shows all the XML codes as it is written where Merged Manifest shows how they are categorisedand what kind of codes they are. The XML command panel reflect the the changes in real time in the main_menu.xml tab and vise versa.

Changing Theme of New Android App

Let's see how XML command panel changes the codes when we change the theme of new app.

Go to main_menu.xml > Select the "material" [near language] > Select Holo Dark > Holo.Dialogue[search if you want]> Press Ok.

Go to AndroidManifest.xml and you can see a new codes has been added. Those codes will look like this.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.admin.myapplication">
<application android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:background="#ff2438"
<activity android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

You can also insert the these codes in XML command panel and see how it reflect in main_menu.xml. You can play around with other options just to see how editing works and how it changes the app design.


We have covered the topic of how to accessXML Editing Panel. Let us use layout editor that helps us create user interfacein Android Studio v 2.3.3 in this tutorial.

Accessing Layout Editor in Android Studio v 2.3.3

Open Android Studio

Open your App Project

You can see 3 basic options in Android Studio;

MainActivity.java -This is where you code using Java where the system creates a layout from these codes. The alyout is manifested in activity_main.xml.

activity_main.xml- Layout of the app. It will have all the elements which you can see actually. So if you add a text box element code using java in ManiActivity.java, that code will manifest as text box inhere.

AndroidManifest.xml -This is an XML file which shows all the characteristics of the app.

UI or User Interface - It means that how a user of your app see the app and interact with it using an interface.


Open The Layout Editorin Android Studio v 2.3.3

Underactivity_main.xml, you can see two tabs in the bottom; design and text. By clicking design you can see the layout option and by clicking text, you can see both XML codes and in the right side layout.

design and text
design and text

Let's get familiarwith three more options in design tab of Android Studio v 2.3.3.

Design, Blue Print, Design+ Blue Print

These 3 options can be seen on top of the Design tab.

design and blue print in android studio
design and blue print options on top

Click on Show Blue Print only so that you can see blue print of the layout.

The Show constraints button should be on. For that click on the eye under the blue print option and make it look like this...eye button in app making .

Autoconnect should be off. For that make sure the button near to the eye button looks like this by clicking on that..autoconnect button in app making.


Click on the number "8" that says Default Margin in the same tool bar. You could see mutiple options such as 0, 8, 16, 24 dp. Select "16".

On top of Default Margin button, you could see Device in Editor, that has a list of model number sof mobile phones from Nexus, Pixel, Galaxy Nexus etc. Select Pixel XL from the list.

You could see TextView option underConstraintLayout and when you click on that you could see different position of views in the right sidebar.

ConstraintLayout in Android Studio
ConstraintLayout in Android Studio
Delete the TextView option under theConstraintLayout.

If you are finding any warnings of the codes, you can click on the bell button on top rightand select suggested fixes. You will get error message like the one below in that.

Message: [I18N] Hardcoded string "Ship Me This", should use `@string` resource

Suggested Fixes:
- Extract string resource
- Suppress: Add tools:ignore="HardcodedText" attribute

Priority: 5 / 10 Category: Internationalization Severity: Warning Explanation: Hardcoded text. Hardcoding text attributes directly in layout files is bad for several reasons: * When creating configuration variations (for example for landscape or portrait)you have to repeat the actual text (and keep it up to date when making changes) * The application cannot be translated to other languages by just adding new translations for existing string resources. There are quickfixes to automatically extract this hardcoded string into a resource lookup.

Try playing around with other options too. Subsribe shipmethisto get all app making tutorials....


Kindly spend 5 seconds to share this post



Search Here

Whats Hot

About Author