0% found this document useful (0 votes)
280 views

Lesson 1 Android Development: Victor Matos

This document provides an overview of Android development including the history and evolution of mobile phones, the hardware and software components of Android, how Android applications are structured, and the role of the Android manifest file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
280 views

Lesson 1 Android Development: Victor Matos

This document provides an overview of Android development including the history and evolution of mobile phones, the hardware and software components of Android, how Android applications are structured, and the role of the Android manifest file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Lesson 1

Android Development
Introduction
Victor Matos
Cleveland State University

Portions of this page are reproduced from work created and shared by Google and used according to terms
described in the Creative Commons 3.0 Attribution License.
Mobile Phone Evolution

• Alexander Graham Bell became the first to


receive a patent for the electric phone.
1876

• Alfred Gross. Case Tech OH (Case Western


Reserve University). Invented/Patented
1936 Walkie-talkie, CB radio, Telephone Pager.

Chester Gould

• Dr. Martin Cooper invented first commercial


portable Motorola radio phone
1975

• iPhone
• Android
2007

1-2
Images from: http://en.wikipedia.org/wiki/Dick_Tracy http://en.wikipedia.org/wiki/Martin_Cooper_(inventor)
Hardware: What is inside a Smart Cellular Phone?

Oversimplifying…

Smart cellular phone ≥ radio + computer*

= +

Industries ⟵ ∑ Software + Telecom+ Semiconductor + Marketing

1-3
Software: What is Android?

• Android OS is an open-source Linux-based operating system for mobile


devices.

• It is being developed by the Open Handset Alliance and Google Inc.

• The operating system has a number of native applications supporting


telephony, messaging, emailing, contact management, calendar,
entertainment, multimedia experience, location services, mapping, social
interaction, etc.

• Third party Java developers can use the Android API to extend the
functionality of the devices.

• Google provides an on-line electronic market for third-party developers to


sell-distribute their custom applications.

1-4
What is the Open Handset Alliance?

A consortium of 80+ technology and mobile business companies.

Quoting from www.OpenHandsetAlliance.com site (2/25/2012)

“ … Today, there are 1.5 billion television sets in use around the
world. 1 billion people are on the Internet. But nearly 3 billion people
have a mobile phone, making it one of the world’s most successful
consumer products…

Building a better mobile phone would enrich the lives of countless


people across the globe.

The Open Handset Alliance™ is a group of mobile and technology


leaders who share this vision for changing the mobile experience for
consumers …”

1-5
Open Handset Alliance Members

Operators Software Co. Commercializat. Semiconductor Handset Manf


Bouygues Tele Ascender Corp. Accenture ARM ACER
China Mobile Borqs Aplix Atheros ASUS
China Telec. eBay Astonishing Tribe Audience Dell
China Unicom Esmertec Noser Engineering Broadcom Corp. Garmin
KDDI Corp. Google Omron Software CSR Plc. HTC
NTT DoCoMo LivingImage Sasken Cypress Kyocera
Softbank NMS Comm. Teleca Freescale Lenovo Mobile
Sprint Nextel Nuance Comm. … Gemalto LG
Telecom Italia PacketVideo Wind River Systems Intel Corp. Motorola
Telefónica SkyPop Marvell Tech NEC
Telus … MediaTek
T-Mobile SONiVOX MIPS Techn. Samsung
... Nvidia Corp Sharp
Vodafone Qualcomm …
Renesas Corp Sony Ericsson
ST-Ericsson …
Synaptics Toshiba
Texas Instrum.
Via Telecom
1-6
The Mobile Revolution

Electronic tools commonly carried by a typical business warrior

Not so long ago … Today

1. Phone 1. Smartphone
2. Pager 2. Laptop (perhaps!)
3. PDA Organizer
4. Laptop
5. MP3 Portable music player
6. Wired modem
7. No Internet access / limited
access

Tomorrow ?
1-7
The Mobile Revolution

Dreaming aloud
I want my 2018 Smartphone to be …
1. Phone
2. Pager
3. PDA Organizer
4. High Quality Camera (still & video)
5. Portable music player
6. Portable TV / Video Player / Radio
7. Laptop
8. Play Station
9. GPS / Compass / Navigation (road & inside buildings)
10. Golf Caddy (ball retriever too)
11. Book Reader (I don’t read, It reads to me with passion!)
12. Electronic key (Car / Home / Office)
13. Remote Control (Garage, TV, …)
14. Credit Card / Driver’s License / Passport / Airplane Ticket
15. Cash
16. Cook, house chores
17. Psychologist / Mentor / Adviser
18. Personal trainer
19. Dance instructor
20. ???? 1-8
Android vs. OS Competitors

1.Apple Inc.
2.Microsoft
3.Nokia Symbian
vs. 4.Palm & webOS
5.Research In Motion

1-9
Number of Android applications

The number of available apps in the Google Play Store was most recently
placed at 3.8 million apps in March 2018
1 - 10
Number of apps available in leading app stores (Mar 2018)

1 - 11
Number of Android Devices

1 - 12
Type of Android Devices

• Smartphone, Tablet
• Wear OS
• TV
• Android Auto
• Android Things

1 - 13
Android Software/Hardware Components

• Dalvik virtual machine (soon to be replaced by ART )


• Integrated browser (WebKit)
• Graphic Capabilities (hardware acceleration)
• SQLite for structured data storage
• Media support (audio/video)
• GSM Telephony (hardware dependent)
• Bluetooth, EDGE, 3G, 4G, NFC, and Wi-Fi (hardware manufacturer
dependent)
• Camera, GPS, compass, accelerometer, gyroscope, proximity/ambient
light, barometric pressure, fingerprint reader, heart rate sensor
(hardware dependent)
• Software Development Tools & Application framework
(device emulator, debugging, profiling, plugin for the Eclipse IDE, resource
managers, Android Studio)

1 - 14
Android’s Software Architecture

1 - 15
Dissecting an Android Application

Structure of a
typical Android
Application

(Shown by Eclipse’s
Project Explorer)

1 - 16
Dissecting an Android Application

Structure of a
typical Android
Application

(Android Studio)

1 - 17
Android Manifest XML File

• Every application must have an


AndroidManifest.xml file
in its root directory.

• The manifest presents essential information


about the application to the Android system,
for instance it has an entry for each activity,
library request, and special permissions
needed to assemble the app.

1 - 18
Android Manifest XML File

This is a list of the <XML-elements> allowed in the Manifest file.

<action> <permission>
<activity> <permission-group>
<activity-alias> <permission-tree>
<application> <provider>
<category> <receiver>
<data> <service>
<grant-uri-permission> <uses-configuration>
<instrumentation> <uses-library>
<intent-filter> <uses-permission>
<manifest> <uses-sdk>
<meta-data>

1 - 19
Android Manifest XML File
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="matos.earthquake"
android:versionCode="1"
android:versionName="1.0.0">
<application android:icon="@drawable/yellow_circle" android:label="@string/app_name">

<activity android:name=".AndQuake"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".SatelliteMapping"> </activity>

<service android:name="AndQuakeService" android:enabled="true" >


</service>

<receiver android:name="AndQuakeAlarmReceiver" >


<intent-filter>
<action
android:name = "ALARM_TO_REFRESH_QUAKE_LIST"/>
</intent-filter>
</receiver>
</application>

<uses-library android:name="com.google.android.maps" />


<uses-permission android:name="android.permission.INTERNET" />

</manifest> 1 - 20
Example2. Currency converter

Implementing a currency converter:


USD ⟶ Euro ⟶ Colon (CR)

Note.
Naive implementation using a fixed
exchange rate:
1 Costa Rican Colon = 0.0019 U.S. dollars
1 Euro = 1.35 U.S. dollars

1 - 21
Example2. Currency converter
package csu.matos.currencyconverter;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Currency1 extends Activity {


//USA money format (12 digits, 2 decimals)
DecimalFormat usaDf = new DecimalFormat("###,###,###,###.##");

// naive currency converter (USD to Euros & Colones)


private final double EURO2USD = 1.35;
private final char EUROSYM = '\u20AC';
private final double COLON2USD = 0.0019;
private final char COLONSYM = '\u20A1';
// GUI widgets
Button btnConvert;
Button btnClear;
EditText txtUSDollars;
EditText txtEuros;
EditText txtColones;
1 - 22
Example2. Currency converter
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_linear);

// bind local controls to GUI widgets


txtUSDollars = (EditText)findViewById(R.id.txtUSDollars);
// make ‘Euros’ box not-editable (no user input)
txtEuros = (EditText)findViewById(R.id.txtEuros);
txtEuros.setInputType(EditorInfo.TYPE_NULL);
// No user input. See layout: android:editable=“false”
txtColones = (EditText)findViewById(R.id.txtColones);

// attach click behavior to buttons


btnClear = (Button)findViewById(R.id.btnClear);
btnClear.setOnClickListener(new OnClickListener() {
// clear the text boxes
@Override
public void onClick(View v) {
txtColones.setText("");
txtEuros.setText("");
txtUSDollars.setText("");
}
});

1 - 23
Example2. Currency converter
// do the conversion from USD to Euros and Colones
btnConvert = (Button) findViewById(R.id.btnConvert);
btnConvert.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
String usdStr = txtUSDollars.getText().toString();
double usd = Double.parseDouble(usdStr);
String euros = EUROSYM +
String.valueOf(usaDf.format(usd / EURO2USD));
String colones = COLONSYM +
String.valueOf(usaDf.format(usd / COLON2USD));
txtEuros.setText(euros);
txtColones.setText(colones);
} catch (NumberFormatException e) {
// ignore errors
}

}
});// setOnClick...

}// onCreate

}// class

1 - 24
Example2. Currency converter

11-25
- 25
Example2. Currency converter
LAYOUT: res/layout/activity_main_linear.xml (1 of 3)

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="2dp" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="5"
android:gravity="right"
android:text="US Dollars" />

<EditText
android:id="@+id/txtUSDollars"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="Enter US Dollars amount"
android:inputType="numberDecimal" />

<requestFocus />
</LinearLayout>
1 - 26
Example2. Currency converter
LAYOUT: res/layout/activity_main_linear.xml (2 of 3)
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="5"
android:gravity="right"
android:text="Euros" />

<EditText
android:id="@+id/txtEuros"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="5"
android:gravity="right"
android:text="Colon CR" />
1 - 27
Example2. Currency converter
LAYOUT: res/layout/activity_main_linear.xml (3 of 3)
<EditText
android:id="@+id/txtColones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:editable="false" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<Button
android:id="@+id/btnClear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Clear" />

<Button
android:id="@+id/btnConvert"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Convert" />
</LinearLayout>

</LinearLayout>
1 - 28
Thanks for being here

Questions?

1 - 29
Mobile Software Development

You might also like