0% found this document useful (0 votes)
82 views33 pages

Build Your First Android App Guide

This document provides a step-by-step guide for developing a simple Android app using Android Studio, starting with creating a new project and configuring it. It covers selecting the target platform, choosing an app template, and designing the user interface with a 'Hello World' message. Finally, it explains how to run the app on an emulator or a real device, preparing the user for further learning in subsequent lectures.

Uploaded by

Alok Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views33 pages

Build Your First Android App Guide

This document provides a step-by-step guide for developing a simple Android app using Android Studio, starting with creating a new project and configuring it. It covers selecting the target platform, choosing an app template, and designing the user interface with a 'Hello World' message. Finally, it explains how to run the app on an emulator or a real device, preparing the user for further learning in subsequent lectures.

Uploaded by

Alok Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CHAPTER 3

DEVELOPING
FIRST
ANDROID
APP
Developing First App
 The quickest way to get to know Android Studio is to use it
to develop an app.

 We'll start with a little mobile app that displays the


message “Hello World“.
Creating The Project
 The first step in the application development process is to
create a new project within the Android Studio
environment.

 Begin, therefore, by launching Android Studio so that the


“Welcome to Android Studio” screen appears
Creating The Project
Creating The Project
 Once this window appears, Android Studio is ready for a
new project to be created.

 To create the new project, simply click on the Start a new


Android Studio project option to display the first screen of
the New Project wizard
Configuring The Project
Configuring The Project
 Enter MyFirstApplication as the application name
and [Link] as the company domain name.

 Set any location on your hard-drive to save your project . I


have chosen D:\MyAndroidStudioProjects .

 Click Next to select your target devices.


Select Target Platform
Select Target Platform
 On the form factors screen, enable the Phone and Tablet
option and set the minimum SDK setting .

 The higher the minimum SDK selection, the more the application
will be restricted to newer Android devices.

 A useful chart can be viewed by clicking on the Help me


choose link.
Select Target Platform

As a general rule we
will be using Android
Jelly Bean 4.1 as our
minimum SDK version
Select Target Platform
Selecting The App
Template

 Click Next, and you will be given the opportunity to


choose a template for your app's main activity.

 For now we'll stick with Empty Activity.

 Select this template and click Next.


Selecting The App
Template
Entering Basic Details

 In the Customize the Activity screen, keep the default


values and click Finish.
Entering Basic Details
Developing First App
 Android Studio will respond that it is creating the project,
then take you to the project workspace

 Now Android Studio displays our app with some default


screens
Developing First App
 The key things to notice are that moving from left to right we
have:

 The project window


 The designer split into its Palette and a Layout window
 A component tree window and a properties window at the far
right.

 However most of the time we will be using the Project window


and the Layout window.
The Code Screen
The Default Screen

 On the top of the screen we would see two tabs called


activity_main.xml and [Link]

 The activity_main.xml file shows the initial user interface of


our app.

 Click on this tab to open it’s design view


The Design Screen
The Design Screen

 The design tab allows us to drag and drop the components


from palette to the main screen and then customize their
properties.

 By default our screen contains a TextView ( in Android a


TextView is same as Label of Java) with the sample text Hello
World

 Further in the next session we will see how to customize this


screen
The Text Screen

 Another way to look at the activity_main.xml file is to open


the text view.

 This view shows the complete XML code generated for


designing the UI
The Text Screen
Running The App
 There are two distinct ways of running an Android app
using Android Studio:

 We can use the emulator or


 a real Android device.

 The emulator only allows us to test a subset of things and it


is slow.
Running The App
 However for the moment running our first app on an
emulator is quite enough to get started.

 All we have to do is click the green run icon in the top


toolbar - or use the Run”Run app" menu item.

 When we do this for the first time it will take a while for
the app to be compiled.
Running The App
 When our app is ready to be compiled we will see a
dialog box appear which allows us to either select a
running emulator or start one going.
Running The App
Running The App
 If there are no emulators listed then we will have to create
one.

 Select the Create New Emulator button. This will present a


dialog box where we can select the device we want to test
on.

 The default is the Nexus 5 and for a first test we might as


well use this.
Running The App
Running The App
 We can accept all of the defaults in this first run.

 If you need other devices we can use the AVD Manager to


define them – which we will see later.
Running The App
 Once we have at least one emulator defined we can select
it and it will load and prepare to run our program.

 The whole process takes some time the first time we do it.

 And finally our app will be loaded to the emulator and


the default text “Hello World” would be displayed.
The Output
End Of Lecture

For any queries mail us @: scalive4u@[Link]


Call us @ : 0755-4271659, 7879165533

Agenda for Next Lecture:


1. Understanding The Project Structure
2. Learning XML
3. Understanding Android’s Layout File
4. Understanding The Java Code

You might also like