Lesson 1 Android Development: Victor Matos
Lesson 1 Android Development: Victor Matos
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
Chester Gould
• 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…
= +
1-3
Software: What is Android?
• Third party Java developers can use the Android API to extend the
functionality of the devices.
1-4
What is the Open Handset Alliance?
“ … 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…
1-5
Open Handset Alliance Members
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
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
1 - 18
Android Manifest XML 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>
</manifest> 1 - 20
Example2. Currency converter
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;
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)
<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