0% found this document useful (0 votes)
78 views38 pages

Name: Omar Magdy Abd El Zaher Mohamed Refaei ID: 32016272 Course Name: Android App Development 3hands

This document provides an overview of an Android app development course. The course covers basics of Android like data types, control flow, activities and intents. It also covers topics like services, broadcast receivers, resources and practical examples. The course uses Android Studio as the IDE and teaches setting up the development environment, creating "Hello World" apps, understanding the Android lifecycle and more. It includes abbreviations commonly used in Android development.

Uploaded by

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

Name: Omar Magdy Abd El Zaher Mohamed Refaei ID: 32016272 Course Name: Android App Development 3hands

This document provides an overview of an Android app development course. The course covers basics of Android like data types, control flow, activities and intents. It also covers topics like services, broadcast receivers, resources and practical examples. The course uses Android Studio as the IDE and teaches setting up the development environment, creating "Hello World" apps, understanding the Android lifecycle and more. It includes abbreviations commonly used in Android development.

Uploaded by

omar magdy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 38

Name : Omar Magdy Abd El Zaher Mohamed Refaei

ID : 32016272
Course Name: Android App Development
3Hands
2 Android app development

Course Content :-
 abreviations
 Introduction to Android
 Android history
 Chapter 1 :- Basics
 Data types and control flow statements
 Control flow statements
 If else statements
 For loop
 Setup Encviroment
 Android virtual Device
 Hello world app
 Android Life cycle
 Activities in android
 Activities and intents
 Chpater 2 :- services and broadcast receivers
 Location manager
 Broadcast receiver
 Chpater 3 :- Resources folder
 Strings
 Styles
 Colors
 Chapter 4:- Practical examples
 A simple greetings application
 Changing background color app
 Conclusions
 References

 Abbreviations

Omar Magdy
2
3 Android app development

IDE: Integrated development environment is the software used in creating new


applications.
AVD: Android virtual device is used in testing and debugging the program.
SDK: Software development kit is a plug-in for the IDE required for testing the code.
App: The application is the project created by the android studio which contains all the
data and code created by the developer.
API: is an integer value that uniquely identifies the framework API revision offered by a
version of the Android platform.
UI: User interface is what the user sees and interacts with when using an application

Omar Magdy
3
4 Android app development

 Introduction to Android
Android is a mobile operating system developed by Google based on a modified
version of the Linux kemel and other open source software and designed primarily
for touchscreen mobile devices such as smartphones and tablets In addition, Google has
further developed android TV for televisions, Android Auto for cars, and Wear Os for wrist
watches, each with a specialized user interface. Variants of Android are also used on game ,
consoles , digital cameras , PC’s and other electronics.
Initially developed by Android Inc., which Google bought in 2005, Android was unveiled in
2007, with the first Commercial Android Device launched in September 2008. The operating
system has since gone through multiple major releases, with the current version being 8.1
“Oreo”, released in December 2017.

Omar Magdy
4
5 Android app development

 Android History

Alpha
There were at least two internal releases of the software inside
Google and the OHA before the beta version was released.
To avoid confusion, the code names "Astro Boy" and "Bender" were
only known to be tagged internally on some early pre-1.0 milestone
builds, and thus were never used as the actual code names of
the 1.0 and 1.1 release of the OS, as many people are mistakenly
calling and repeating on the web. Dan Morrill created some of the first
mascot logos, but the current Android logo was designed by Irina
Blok. The project manager, Ryan Gibson, conceived the
confectionery-themed naming scheme that has been used for the
majority of the public releases, starting with Android 1.5 Cupcake.
Beta
The beta was released on November 5, 2007, while the software
development kit (SDK) was released on November 12, 2007. The
November 5 date is popularly celebrated as Android's
"birthday". Public beta versions of the SDK were released in the
following order:

 Nove/mber 12, 2007: m3-rc20a (milestone 3, release code 20a)

Omar Magdy
5
6 Android app development

 November 16, 2007: m3-rc22a (milestone 3, release code 22a)

 December 14, 2007: m3-rc37a (milestone 3, release code 37a)

 February 13, 2008: m5-rc14 (milestone 5, release code 14)

 March 3, 2008: m5-rc15 (milestone 5, release code 15) ]

 August 18, 2008: 0.9 Beta

 September 23, 2008: 1.0-r1

 Creation :-
Android Inc. was founded in palo alto, California in October 2003 by Andy Rubin, Rich
Miner, Nick Sears, and Chris White. Rubin described the Android project as "tremendous
potential in developing smarter mobile devices that are more aware of its owner's location
and preferences". The early intentions of the company were to develop an advanced
operating system for digital cameras, and this was the basis of its pitch to investors in April
2004.[16] The company then decided that the market for cameras was not large enough for its
goals, and by five months later it had diverted its efforts and was pitching Android as a
handset operating system that would rival Symbian and Microsoft Windows Mobile.
Rubin had difficulty attracting investors early on, and Android was facing eviction from its
office space. Steve Perlman, a close friend of Rubin, brought him $10,000 in cash in an
envelope, and shortly thereafter wired an undisclosed amount as seed funding. Perlman
refused a stake in the company, and has stated "I did it because I believed in the thing, and I
wanted to help Andy."
In July 2005, Google acquired Android Inc. for at least $50 million. Its key employees,
including Rubin, Miner and White, joined Google as part of the acquisition. Not much was
known about the secretive Android at the time, with the company having provided few details
other than that it was making software for mobile phones. At Google, the team led by Rubin
developed a mobile device platform powered by the Linux Kemel. Google marketed the
platform to handset makers and carriers on the promise of providing a flexible, upgradeable
system.[21] Google had "lined up a series of hardware components and software partners and
signaled to carriers that it was open to various degrees of cooperation"
Speculation about Google's intention to enter the mobile communications market continued
to build through December 2006. An early prototype had a close resemblance to
a BlachBerry phone, with no touchscreen and a physical Qwerty Keyboard, but the arrival of
2007's Apple Iphone meant that Android "had to go back to the drawing board". Google later
changed its Android specification documents to state that "Touchscreens will be supported",
although "the Product was designed with the presence of discrete physical buttons as an
assumption, therefore a touchscreen cannot completely replace physical buttons". By 2008,
both Nokia and BlackBerry announced touch-based smartphones to rival the Iphone 3G, and
Android's focus eventually switched to just touchscreens. The first commercially available

Omar Magdy
6
7 Android app development

smartphone running Android was the HTC dream, also known as T-Mobile G1, announced
on September 23, 2008.

HTC Dream or T-Mobile G1, the first commercially released device running Android (2008).

On November 5, 2007, the Open Handset Alliance, a consortium of technology companies


including Google, device manufacturers such as HTC, Motorola and Samsung, wireless
carriers such as Sprint and T-Mobile, and chipset makers such as Qualcomm and Texas
Instruments, unveiled itself, with a goal to develop "the first truly open and comprehensive
platform for mobile devices".[29][30][31] Within a year, the Open Handset Alliance faced two
other open source competitors, the Symbian Foundation and the LiMo Foundation, the latter
also developing a Linux-based mobile operating system like Google. In September
2007, InformationWeek covered an Evalueserve study reporting that Google had filed
several patent applications in the area of mobile telephony.[32][33]
Since 2008, Android has seen numerous updates which have incrementally improved the
operating system, adding new features and fixing bugs in previous releases. Each major
release is named in alphabetical order after a dessert or sugary treat, with the first few
Android versions being called "Cupcake", "Donut", "Eclair", and "Froyo", in that order. During
its announcement of Android KitKat in 2013, Google explained that "Since these devices
make our lives so sweet, each Android version is named after a dessert", although a Google
spokesperson told CNN in an interview that "It’s kind of like an internal team thing, and we
prefer to be a little bit — how should I say — a bit inscrutable in the matter, I’ll say". [34]
In 2010, Google launched its Nexus series of devices, a lineup in which Google partnered
with different device manufacturers to produce new devices and introduce new Android
versions. The series was described as having "played a pivotal role in Android's history by
introducing new software iterations and hardware standards across the board", and became
known for its "bloat-free" software with "timely ... updates".[35] At its developer conference in
May 2013, Google announced a special version of the Samsung Galaxy S4, where, instead
of using Samsung's own Android customization, the phone ran "stock Android" and was
promised to receive new system updates fast.[36] The device would become the start of
the Google Play edition program, and was followed by other devices, including the HTC
One Google Play edition,[37] and Moto G Google Play edition.[38] In 2015, Ars Technica wrote
that "Earlier this week, the last of the Google Play edition Android phones in Google's online
storefront were listed as "no longer available for sale" and that "Now they're all gone, and it
looks a whole lot like the program has wrapped up". [39][40]

Eric Schmidt, Andy Rubin and Hugo Barra at a 2012 press conference announcing Google's Nexus 7
tablet

From 2008 to 2013, Hugo Barra served as product spokesperson, representing Android at
press conferences and Google I/O, Google’s annual developer-focused conference. He left
Google in August 2013 to join Chinese phone maker Xiaomi.[41][42] Less than six months
earlier, Google's then-CEO Larry Page announced in a blog post that Andy Rubin had moved

Omar Magdy
7
8 Android app development

from the Android division to take on new projects at Google, and that Sundar Pichai would
become the new Android lead.[43][44] Pichai himself would eventually switch positions,
becoming the new CEO of Google in August 2015 following the company's restructure into
the Alphabet conglomerate, making Hiroshi Lockheimer the new head of Android.
In June 2014, Google announced Android One, a set of "hardware reference models" that
would "allow [device makers] to easily create high-quality phones at low costs", designed for
consumers in developing countries. In September, Google announced the first set of Android
One phones for release in India. However, Recode reported in June 2015 that the project
was "a disappointment", citing "reluctant consumers and manufacturing partners" and
"misfires from the search company that has never quite cracked hardware". Plans to
relaunch Android One surfaced in August 2015, with Africa announced as the next location
for the program a week later. A report from The Information in January 2017 stated that
Google is expanding its low-cost Android One program into the United States, although The
Verge notes that the company will presumably not produce the actual devices itself.
Google introduced the Pixel and pixel xl smartphones in October 2016, marketed as being
the first phones made by Google, and exclusively featured certain software features, such as
the Google Assistant, before wider rollout. The Pixel phones replaced the Nexus series,
[64]
with a new generation of Pixel phones launched in October 2017.

Omar Magdy
8
9 Android app development

 Chapter 1: Data types & control flow statements


Data is the code and resources added by the developer. However, data must first be
identified in terms name and type
E.g. int x =;
Some frequently used data types are:

 String is a sentence containing numbers and letters.

 Float is a decimal number.

 Double is a decimal number but with more accuracy than float.

 Character (char): is a single character

 Integer

 Boolean is a statement which has only two outcomes. True or false.

Control flow statements:

Control flow statements are what controls the movement or the sequence of actions
performed by the code. The most popular control flow statements are:

If-else statements

Omar Magdy
9
10 Android app development

For loop:

Is similar to the if statement but more efficient when stating multiple conditions.
For (variable,condition,operation)
E.g. For (i=0,i>2,i++)

 Setup Enviroment :-
 In the Welcome to Android Studio window, click Start a new Android Studio
project.

Or if you have a project opened, select File > New Project.


 In the Create New Project window, enter the following values:
o Application Name: "My First App"
o Company Domain: "example.com"
You might want to change the project location. Also, if you want to write a Kotlin
app, check the Include Kotlin support checkbox. Leave the other options as
they are.
 Click Next.
 In the Target Android Devices screen, keep the default values and click Next.
 In the Add an Activity to Mobile screen, select Empty Activity and click Next.
 In the Configure Activity screen, keep the default values and click Finish.

Omar Magdy
10
11 Android app development

After some processing, Android Studio opens the IDE.

Now take a moment to review the most important files.

First, be sure the Project window is open (select View > Tool Windows >
Project) and the Android view is selected from the drop-down list at the top of
that window. You can then see the following files:

app > java > com.example.myfirstapp > MainActivity

This is the main activity (the entry point for your app). When you build and run
the app, the system launches an instance of this Activity and loads its layout.

app > res > layout > activity_main.xml

This XML file defines the layout for the activity's UI. It contains a textview element
with the text "Hello world!".

app > manifests > AndroidManifest.xml

The manifest file describes the fundamental characteristics of the app and
defines each of its components.

Gradle Scripts > build.gradle

Omar Magdy
11
12 Android app development

You'll see two files with this name: one for the project and one for the "app"
module. Each module has its own build.gradle file, but this project currently has
just one module. You'll mostly work with the module's build.gradle file to configure
how the Gradle tools compile and build your app.

 Android Virtual Device (AVD)

An Android Virtual Device (AVD) is an emulator configuration that allows developers


to test the application by simulating the real device capabilities. We can configure
the AVD by specifying the hardware and software options. AVD manager enables an
easy way of creating and managing the AVD with its graphical interface. We can
create as many AVDs as we need, based on the types of device we want to test for.

The hardware profile defines the characteristics of a device as shipped from the factory.
The AVD Manager comes preloaded with certain hardware profiles, such as Pixel
devices, and you can define or customize the hardware profiles as needed.
A system image labeled with Google APIs includes access to Google Play services. A
system image labeled with the Google Play logo in the Play Store column includes the
Google Play Store app and access to Google Play services, including a Google Play tab in
the extended controls dialog that provides a convenient button for updating Google Play
services on the device.
The AVD has a dedicated storage area on your
development machine. It stores the device user data,
such as installed apps and settings, as well as an
emulated SD card. If needed, you can use the AVD
Manager to wipe user data, so the device has the
same data as if it were new

 Hello world in
android :-

The hello world application is the simplest


application in the android studio. It basically
doesn’t contain a single line of code written by

Omar Magdy
12
13 Android app development

the developer. The creation of this app basically means that the developer can
successfully create a project using android studio.
Steps:

1. Click on start a new android project.


A new image should appear with the following parameters which could
be changed.
Application name: changing the project’s name.
Company domain: the ability to add a website for the application or the
developing company.
Project location: the location of the project and including it’s resources on
the computer’s Disk drive.

Omar Magdy
13
14 Android app development

2. After pressing next a new window should appear in which you specify the
devices and the minimum required android OS API.

Omar Magdy
14
15 Android app development

3. The next window is the activity selection window where usually the main
(primary) activity is selected.

Omar Magdy
15
16 Android app development

4. The 4th window is responsible for selecting the activity and its layout’s
names.

5. After some processing a new window should appear with the layout
design tab. The layout is the UI that the user interacts with which can be
customized by adding the components using the design tab or by
inserting the components and their parameters as lines of code in the
text tab.

Omar Magdy
16
17 Android app development

Omar Magdy
17
18 Android app development

6. After pressing run from the toolbar the AVD selection appears.

Omar Magdy
18
19 Android app development

7. A new AVD appears with the app running.

Omar Magdy
19
20 Android app development

 Android Life cycle

The android life cycle is usually a 4-step cycle that most applications have to
go through during which several unique actions are performed in every
cycle. It consists of four override methods
onCreate():Called then the activity is created. Used to initialize the
activity, for example create the user interface.
onResume():Called if the activity get visible again and the user starts
interacting with the activity again. Used to initialize fields, register listeners,
bind to services, etc.
onPause():Called once another activity gets into the foreground. Always
called before the activity is not visible anymore. Used to release resources or
save application data. For example you unregister listeners, intent receivers,
unbind from services or remove system service listeners.
onStop():Called once the activity is no longer visible. Time or CPU
intensive shut-down

Omar Magdy
20
21 Android app development

 Activities in android :-
 Activities are java codes that support the UI. They are basically what every user can
do in the application without editing the code itself such as: dialing numbers, taking
photos, sending mail. They contain most of the code needed to run the application
and in terms of visuals it can be edited from the layout resource folder.

Omar Magdy
21
22 Android app development

 Activities and intents :-

As a developer when creating an application .The application will


consist of more than one activity so the intent is used in transitions
between the activities .

Omar Magdy
22
23 Android app development

 Chapter 2: Service & Broadcast receivers


 A service is an application component that can perform long-running operations
in the background, and it doesn't provide a user interface. It usually requires
special permissions in order to run. Another application component can start a
service, and it continues to run in the background even if the user switches to
another application.

 Location manager
 A location manager is a service which uses the device’s GPS in order. This class
provides access to the system location services. These services allow applications
to obtain periodic updates of the device's geographical location. A device’s
location is usually obtained using 3 methods: the location of the closest signal
tower, the location of the router if the device is using its wireless network, or by
triangulating the device’s location via 16 satellites orbiting the earth.
 Location managers require permission to access the coarse and fine locations of
the device which can be entered in the manifests file.

The Service can be used for example to show the user his location whenever he walks a
certain distance during a certain period. Conditions can change according to the changes
in the device itself such as: change in the location or changes in the provider’s status.

 Broadcast Receiver
Broadcast receiver is an Android component which allows you to send or receive
Android system or application events. All the registered applications are notified by the
Android runtime once event happens.
Similar to location services, sometimes they require a special permission or
Permission to use a feature to monitor changes in the device and its
android OS which are entered

Omar Magdy
23
24 Android app development

Omar Magdy
24
25 Android app development

For example, Broadcast receivers can monitor battery percentage and take actions based
on that change such as changing color or displaying a pop-up with the battery
percentage shown

Omar Magdy
25
26 Android app development

 Chapter 3: Resources folder


Resources are the additional files and static content that your code uses, such as
bitmaps, layout definitions, user interface strings, animation instructions, and more.

The Values folder contains all the Strings, colors and styles used in the application.

Strings:

A string resource provides text strings for your application with optional text styling and
formatting

Styles:

A style resource defines the format and look for a UI. A style can be applied to an
individual View (from within a layout file) or to an entire Activity or application (from
within the manifest file).

Omar Magdy
26
27 Android app development

Colors:

Color resource contains all the colors used in the application which can be used in the
application. The colors can be used to change all the applications assets in the UI like
background, buttons and text color.
Android uses standard RGB (red, green and blue) color model. Each primary color value
is usually represented by hexadecimal number. At the beginning of such a color
definition you have to put a pound character (#).
The simplest is just #RGB format, where #000 is black and #FFF is white. But in this
format we have only 16 values per color so it gives 4096 combinations. That’s why
#RRGGBB format is mainly used. In this format we have 256 values per primary color, so
16 777 216 colors in total. Black is #000000 and white is #FFFFFF.

Omar Magdy
27
28 Android app development

 Chapter 4: Practical examples


A simple greetings application
The objective is to simply create an application which greets the user with “hi+the
entered name”.
Steps:
1. Create a new android studio project with a blank activity.

2. In the main activity layout file add a button, a text view and a text box and give
them IDs.

Omar Magdy
28
29 Android app development

3. In the main activity identify the button, text view and textbox.

4. Set btn as an OnClicklistener

5. In the OnClick Override method, the entered string name is received and
transformed into string. The entered name in the text box is then copied to the
text view and a “hello” is added before the name.

Omar Magdy
29
30 Android app development

6. Click Run from the toolbar and select an AVD.

Omar Magdy
30
31 Android app development

7. After the app starts running enter a name in the textbox

Omar Magdy
31
32 Android app development

 Changing background color app

This app is used to cycle between 3 background colors using three methods: The
location manager, Broadcast receiver and a single button using an onclick listener.
Steps:
1. Create a new project with a blank activity.

2. Add a button and a relative layout and identify them.

3. In the manifests file add permission to access the coarse and fine location.

Omar Magdy
32
33 Android app development

4. Identify the layout & button in the main activity and set an onclick listener for the
button and an integer.

5. In the onClick override method add an if condition.

6. State the condition that if the integer changes in value the background is
changed and if the integer excceds a certain value the integer goes back to its

Omar Magdy
33
34 Android app development

original value. Therefore returning to the original color.

7. For the location manager method, a service isn’t needed since the process isn’t
required to run in the background. So the location manager should be identified
in the main activity along with the conditions on status change.

Omar Magdy
34
35 Android app development

8. Add a broadcast listener with the condition of changing color on battery level
change.

 Conclusion :-
 At the end of the training period trainees should be able to create simple apps
and understand the coding and the logic behind the processes. New and
innovative ways of thinking are introduce to the trainees to help them deal with
everyday problems using android applications that they developed.
 The course introduced most of the android studio’s basic functions and simple
java codes. Data types and control flow statements are introduced in addition to
several override methods. The basic functionalities and the UI of the Android
studio and the Android virtual device are explained by the instructor.
 Resources folder is explained along with its values subfolder including the style,
color and string subfolders.
 Several practical examples are introduced in the course including a simple “hello
world” app, a greeting app and a changing background app.

Omar Magdy
35
36 Android app development

 Refrences :-
www.dre.vanderbit.edu
en.wikipedia.com
www.tutorialspoint.com
www.quora.com
www.androidcentral.com
developers.android.com
www.youtube.com

Thanks for reading

Omar Magdy
36
37 Android app development

Omar Magdy
37
38 Android app development

Omar Magdy
38

You might also like