SlideShare a Scribd company logo
1 / 89
PPTB (ET-4044)
Android
Programming
Basics
Eueung Mulyana
https://eueung.github.io/012017/android1
CodeLabs | Attribution-ShareAlike CC BY-SA
Outline
Android & Android Studio
App Development
Building Your First App
2 / 89
Notes
Android Studio 2.3.3 (Stable Channel)
A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the
JDK version recommended for your Android projects. Ref: [Con gure Android Studio]
3 / 89
Android & Android Studio
4 / 89
5 / 89
What is
Android
Mobile operating system based on Linux kernel
User Interface for touch screens
Used on over 80% of all smartphones
Powers devices such as watches, TVs, and cars
Over 2 Million Android apps in Google Play store
Highly customizable for devices / by vendors
Open source
Ref: Android Developer Fundamentals
Android Versions
6 / 89
7 / 89
Android
Studio+ Android SDK
O cial Android IDE
Develop, run, debug, test, and package
apps
Monitors and performance tools
Virtual devices
Project views
Visual layout editor
Ref: Android Developer Fundamentals
8 / 89
Logical Areas
1. Toolbar
2. Navigation Bar
3. Editor Window
4. Tool Window Bar (Expand/Collapse)
5. Tool Window
6. Status Bar
9 / 89
Layout Editor
Project Window (1)
Palette of UI Elements (2)
Selectors (3)
Design Pane (6)
Component Tree (7)
Design/Text Tabs (8)
10 / 89
Layout Editor
Properties Pane (4)
Text Property of TextView (5)
App Development
11 / 89
12 / 89
Android
App
One or more interactive screens
Written using Java Programming
Language and XML (*)
Uses the Android Software Development
Kit (SDK)
Uses Android libraries and Android
Application Framework
Executed by Android Runtime Virtual
machine (ART)
Ref: Android Developer Fundamentals
13 / 89
Android
Challenges
Multiple screen sizes and resolutions
Performance: make your apps responsive and smooth
Security: keep source code and user data safe
Compatibility: run well on older platform versions
Marketing: understand the market and your users (Hint: It
doesn't have to be expensive, but it can be.)
14 / 89
App
Building
Blocks
Resources: layouts, images, strings, colors as XML and
media les
Components: activities, services,... and helper classes as
Java code
Manifest: information about app for the runtime
Build con guration: APK versions in Gradle con g les
15 / 89
Component
Types
Activity is a single screen with a user interface
Service performs long-running tasks in background
Content provider manages shared set of data
Broadcast receiver responds to system-wide
announcements
16 / 89
Think of
Android as a
Hotel
Your App is the guest
The Android System is the hotel manager
Services are available when you request them (Intents)
In the foreground (Activities) such as registration
In the background (Services) such as laundry
Calls you when a package has arrived (Broadcast Receiver)
Access the city's tour companies (Content Provider)
Ref: Android Developer Fundamentals
Android Studio
Building Your First App
17 / 89
18 / 89
Building
Your First App
1. Create an Android Project
2. Run Your App
3. Build a Simple User Interface
4. Start Another Activity
Create an Android Project
19 / 89
Start a New Project 20 / 89
Adjust Application name (& Company domain) 21 / 89
Set Target Devices 22 / 89
Co ee Time ... (If SDK components not yet locally available) 23 / 89
Add Empty Activity 24 / 89
Adjust Activity Name (& Layout Name) 25 / 89
Project Window | app>java> ... >MainActivity.java 26 / 89
app>res>layout>activity_main.xml (Design View)
27 / 89
app>res>layout>activity_main.xml (Text View)
28 / 89
app>manifests>AndroidManifest.xml 29 / 89
@string/app_name 30 / 89
@string/app_name 31 / 89
Run Your App
On an Emulator | On a Real Device
32 / 89
Launch AVD Manager 33 / 89
Create Virtual Device 34 / 89
Select Hardware | Phone 35 / 89
Download System Image (If it's not already there) 36 / 89
Co ee Time ... 37 / 89
Select System Image 38 / 89
Verify -> Finish 39 / 89
Launch this AVD in the Emulator 40 / 89
AVD Launched 41 / 89
Run the App 42 / 89
Select Target 43 / 89
Showtime! 44 / 89
Run Your App
On an Emulator | On a Real Device
45 / 89
46 / 89
USB Debugging
Settings>General >About Device
Note: Titles may vary!
47 / 89
USB Debugging
Build Number
48 / 89
USB Debugging
Build Number | Tap 7x!
49 / 89
USB Debugging
Settings>Developer Options
50 / 89
USB Debugging
Settings>Developer Options | USB Debugging
Note: Titles may vary!
Run | Select Target 51 / 89
52 / 89
Done!
Installed on the Device
Build a Simple User
Interface
53 / 89
Show Blueprint, Show Constraints, Autoconnect O & Default Margin 16 54 / 89
Component Tree | Replace TextView with EditText | Adjust/Drag Constraint Anchors 55 / 89
Add Button | Adjust/Drag Constraint Anchors | Note: Baseline Constraint 56 / 89
Change the UI Strings | String Resources 57 / 89
Change the UI Strings | Translation Editor 58 / 89
Properties | @string/edit_message (Remove text) 59 / 89
Properties | @string/button_send 60 / 89
Select Both | Center Horizontally 61 / 89
A Chain Between the Two Views 62 / 89
Button | Left & Right Margin ->16 63 / 89
Text | Left Margin ->16 | Width Indicator -> Match Constraints 64 / 89
activity_main.xml (Text) 65 / 89
Run & Test 66 / 89
Start Another Activity
67 / 89
sendMessage() Method Stub | Alt + Enter -> Import class 68 / 89
Connect sendMessage() to the Button 69 / 89
app | Create a New Empty Activity 70 / 89
DisplayMessageActivity 71 / 89
DisplayMessageActivity.java 72 / 89
MainActivity.java 73 / 89
activity_display_message.xml | textAppearance 74 / 89
Run & Test 75 / 89
AVD - Landscape 76 / 89
77 / 89
Run & Test
Real Device | SM-N750
78 / 89
Run & Test
Real Device | SM-N750
MainActivity.java | Di
79 / 89
package com.example.em.exampleapplication01;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
public static final String EXTRA_MESSAGE = "com.example.em.exampleapplication01.MESSAGE";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editText);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
}
80 / 89
MainActivity.java
package com.example.em.exampleapplication01;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class DisplayMessageActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
// Get the Intent that started this activity and extract the string
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
// Capture the layout's TextView and set the string as its text
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText(message);
}
}
81 / 89
DisplayMessageActivity.java
activity_main.xml | Di
82 / 89
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.em.exampleapplication01.MainActivity">
<EditText
android:id="@+id/editText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="@string/edit_message"
android:inputType="textPersonName"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toLeftOf="@+id/button"
android:layout_marginLeft="16dp" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:onClick="sendMessage"
android:text="@string/button_send"
app:layout_constraintBaseline_toBaselineOf="@+id/editText"
app:layout_constraintLeft_toRightOf="@+id/editText"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
83 / 89
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.em.exampleapplication01.DisplayMessageActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="TextView"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
84 / 89
activity_display_message.xml
AndroidManifest.xml | Di
85 / 89
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.em.exampleapplication01">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DisplayMessageActivity" android:parentActivityName=".MainActivity"
</application>
</manifest>
86 / 89
AndroidManifest.xml
Refs/Resources
87 / 89
Refs/Resources
1. Getting Started | Android Developers
2. Dashboards | Android Developers
3. Android Developer Fundamentals | Google Developers Training | Google Developers
4. Introduction - Android Developer Fundamentals Course - Practicals
88 / 89
89 / 89
ENDEueung Mulyana
https://eueung.github.io/012017/android1
CodeLabs | Attribution-ShareAlike CC BY-SA

More Related Content

What's hot

Introduction to android
Introduction to androidIntroduction to android
Introduction to android
zeelpatel0504
 
Android UI
Android UIAndroid UI
Android UI
nationalmobileapps
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
amaankhan
 
Basic android-ppt
Basic android-pptBasic android-ppt
Basic android-ppt
Srijib Roy
 
Android app development ppt
Android app development pptAndroid app development ppt
Android app development ppt
saitej15
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecture
deepakshare
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
Shakib Hasan Sumon
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
Aly Abdelkareem
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
Maksym Davydov
 
Android architecture
Android architectureAndroid architecture
Android architecture
Kartik Kalpande Patil
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
Naresh Chintalcheru
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
Soham Patel
 
Android ppt
Android pptAndroid ppt
Android ppt
Ansh Singh
 
Android studio ppt
Android studio pptAndroid studio ppt
Android studio ppt
Swapanpreet Kaur
 
Android Components
Android ComponentsAndroid Components
Android Components
Aatul Palandurkar
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
ma-polimi
 
SQLite database in android
SQLite database in androidSQLite database in android
SQLite database in android
Gourav Kumar Saini
 
Android Architecture.pptx
Android Architecture.pptxAndroid Architecture.pptx
Android Architecture.pptx
priya Nithya
 

What's hot (20)

Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android UI
Android UIAndroid UI
Android UI
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
 
Android Services
Android ServicesAndroid Services
Android Services
 
Basic android-ppt
Basic android-pptBasic android-ppt
Basic android-ppt
 
Android app development ppt
Android app development pptAndroid app development ppt
Android app development ppt
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecture
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Android intents
Android intentsAndroid intents
Android intents
 
Android Platform Architecture
Android Platform ArchitectureAndroid Platform Architecture
Android Platform Architecture
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Android studio ppt
Android studio pptAndroid studio ppt
Android studio ppt
 
Android Components
Android ComponentsAndroid Components
Android Components
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
SQLite database in android
SQLite database in androidSQLite database in android
SQLite database in android
 
Android Architecture.pptx
Android Architecture.pptxAndroid Architecture.pptx
Android Architecture.pptx
 

Similar to Android Programming Basics

Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
Gunjan Kumar
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
sullis
 
Android best training-in-mumbai
Android best training-in-mumbaiAndroid best training-in-mumbai
Android best training-in-mumbai
vibrantuser
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15
sullis
 
Android classes in mumbai
Android classes in mumbaiAndroid classes in mumbai
Android classes in mumbai
Vibrant Technologies & Computers
 
lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdf
jakjak36
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guidemagicshui
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Avinash Nandakumar
 
[Android Codefest] Using the Second-Screen API & Intel® Wireless Display From...
[Android Codefest] Using the Second-Screen API & Intel® Wireless Display From...[Android Codefest] Using the Second-Screen API & Intel® Wireless Display From...
[Android Codefest] Using the Second-Screen API & Intel® Wireless Display From...
BeMyApp
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
Arcadian Learning
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
katayoon_bz
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Keshav Chauhan
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
Ed Zel
 
Android deep dive
Android deep diveAndroid deep dive
Android deep dive
AnuSahniNCI
 
Android
AndroidAndroid
Synapseindia android apps intro to android development
Synapseindia android apps  intro to android developmentSynapseindia android apps  intro to android development
Synapseindia android apps intro to android developmentSynapseindiappsdevelopment
 

Similar to Android Programming Basics (20)

Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
 
Android best training-in-mumbai
Android best training-in-mumbaiAndroid best training-in-mumbai
Android best training-in-mumbai
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15
 
Android classes in mumbai
Android classes in mumbaiAndroid classes in mumbai
Android classes in mumbai
 
lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdf
 
Android
AndroidAndroid
Android
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Android-Tutorial.ppt
Android-Tutorial.pptAndroid-Tutorial.ppt
Android-Tutorial.ppt
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
[Android Codefest] Using the Second-Screen API & Intel® Wireless Display From...
[Android Codefest] Using the Second-Screen API & Intel® Wireless Display From...[Android Codefest] Using the Second-Screen API & Intel® Wireless Display From...
[Android Codefest] Using the Second-Screen API & Intel® Wireless Display From...
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android deep dive
Android deep diveAndroid deep dive
Android deep dive
 
Android
AndroidAndroid
Android
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Synapseindia android apps intro to android development
Synapseindia android apps  intro to android developmentSynapseindia android apps  intro to android development
Synapseindia android apps intro to android development
 

More from Eueung Mulyana

FGD Big Data
FGD Big DataFGD Big Data
FGD Big Data
Eueung Mulyana
 
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Eueung Mulyana
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Eueung Mulyana
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
Eueung Mulyana
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based Approach
Eueung Mulyana
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency Introduction
Eueung Mulyana
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking Overview
Eueung Mulyana
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
Eueung Mulyana
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorial
Eueung Mulyana
 
Basic onos-tutorial
Basic onos-tutorialBasic onos-tutorial
Basic onos-tutorial
Eueung Mulyana
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - Introduction
Eueung Mulyana
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - Introduction
Eueung Mulyana
 
Mininet Basics
Mininet BasicsMininet Basics
Mininet Basics
Eueung Mulyana
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and Examples
Eueung Mulyana
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuators
Eueung Mulyana
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5G
Eueung Mulyana
 
Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+
Eueung Mulyana
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
Eueung Mulyana
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud Computing
Eueung Mulyana
 
Digital Ecosystems - Connected Services and Cloud Computing
Digital Ecosystems - Connected Services and Cloud ComputingDigital Ecosystems - Connected Services and Cloud Computing
Digital Ecosystems - Connected Services and Cloud Computing
Eueung Mulyana
 

More from Eueung Mulyana (20)

FGD Big Data
FGD Big DataFGD Big Data
FGD Big Data
 
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based Approach
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency Introduction
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking Overview
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorial
 
Basic onos-tutorial
Basic onos-tutorialBasic onos-tutorial
Basic onos-tutorial
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - Introduction
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - Introduction
 
Mininet Basics
Mininet BasicsMininet Basics
Mininet Basics
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and Examples
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuators
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5G
 
Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud Computing
 
Digital Ecosystems - Connected Services and Cloud Computing
Digital Ecosystems - Connected Services and Cloud ComputingDigital Ecosystems - Connected Services and Cloud Computing
Digital Ecosystems - Connected Services and Cloud Computing
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 

Android Programming Basics

  • 1. 1 / 89 PPTB (ET-4044) Android Programming Basics Eueung Mulyana https://eueung.github.io/012017/android1 CodeLabs | Attribution-ShareAlike CC BY-SA
  • 2. Outline Android & Android Studio App Development Building Your First App 2 / 89
  • 3. Notes Android Studio 2.3.3 (Stable Channel) A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version recommended for your Android projects. Ref: [Con gure Android Studio] 3 / 89
  • 4. Android & Android Studio 4 / 89
  • 5. 5 / 89 What is Android Mobile operating system based on Linux kernel User Interface for touch screens Used on over 80% of all smartphones Powers devices such as watches, TVs, and cars Over 2 Million Android apps in Google Play store Highly customizable for devices / by vendors Open source Ref: Android Developer Fundamentals
  • 7. 7 / 89 Android Studio+ Android SDK O cial Android IDE Develop, run, debug, test, and package apps Monitors and performance tools Virtual devices Project views Visual layout editor Ref: Android Developer Fundamentals
  • 8. 8 / 89 Logical Areas 1. Toolbar 2. Navigation Bar 3. Editor Window 4. Tool Window Bar (Expand/Collapse) 5. Tool Window 6. Status Bar
  • 9. 9 / 89 Layout Editor Project Window (1) Palette of UI Elements (2) Selectors (3) Design Pane (6) Component Tree (7) Design/Text Tabs (8)
  • 10. 10 / 89 Layout Editor Properties Pane (4) Text Property of TextView (5)
  • 12. 12 / 89 Android App One or more interactive screens Written using Java Programming Language and XML (*) Uses the Android Software Development Kit (SDK) Uses Android libraries and Android Application Framework Executed by Android Runtime Virtual machine (ART) Ref: Android Developer Fundamentals
  • 13. 13 / 89 Android Challenges Multiple screen sizes and resolutions Performance: make your apps responsive and smooth Security: keep source code and user data safe Compatibility: run well on older platform versions Marketing: understand the market and your users (Hint: It doesn't have to be expensive, but it can be.)
  • 14. 14 / 89 App Building Blocks Resources: layouts, images, strings, colors as XML and media les Components: activities, services,... and helper classes as Java code Manifest: information about app for the runtime Build con guration: APK versions in Gradle con g les
  • 15. 15 / 89 Component Types Activity is a single screen with a user interface Service performs long-running tasks in background Content provider manages shared set of data Broadcast receiver responds to system-wide announcements
  • 16. 16 / 89 Think of Android as a Hotel Your App is the guest The Android System is the hotel manager Services are available when you request them (Intents) In the foreground (Activities) such as registration In the background (Services) such as laundry Calls you when a package has arrived (Broadcast Receiver) Access the city's tour companies (Content Provider) Ref: Android Developer Fundamentals
  • 17. Android Studio Building Your First App 17 / 89
  • 18. 18 / 89 Building Your First App 1. Create an Android Project 2. Run Your App 3. Build a Simple User Interface 4. Start Another Activity
  • 19. Create an Android Project 19 / 89
  • 20. Start a New Project 20 / 89
  • 21. Adjust Application name (& Company domain) 21 / 89
  • 23. Co ee Time ... (If SDK components not yet locally available) 23 / 89
  • 25. Adjust Activity Name (& Layout Name) 25 / 89
  • 26. Project Window | app>java> ... >MainActivity.java 26 / 89
  • 32. Run Your App On an Emulator | On a Real Device 32 / 89
  • 35. Select Hardware | Phone 35 / 89
  • 36. Download System Image (If it's not already there) 36 / 89
  • 37. Co ee Time ... 37 / 89
  • 39. Verify -> Finish 39 / 89
  • 40. Launch this AVD in the Emulator 40 / 89
  • 42. Run the App 42 / 89
  • 45. Run Your App On an Emulator | On a Real Device 45 / 89
  • 46. 46 / 89 USB Debugging Settings>General >About Device Note: Titles may vary!
  • 47. 47 / 89 USB Debugging Build Number
  • 48. 48 / 89 USB Debugging Build Number | Tap 7x!
  • 49. 49 / 89 USB Debugging Settings>Developer Options
  • 50. 50 / 89 USB Debugging Settings>Developer Options | USB Debugging Note: Titles may vary!
  • 51. Run | Select Target 51 / 89
  • 52. 52 / 89 Done! Installed on the Device
  • 53. Build a Simple User Interface 53 / 89
  • 54. Show Blueprint, Show Constraints, Autoconnect O & Default Margin 16 54 / 89
  • 55. Component Tree | Replace TextView with EditText | Adjust/Drag Constraint Anchors 55 / 89
  • 56. Add Button | Adjust/Drag Constraint Anchors | Note: Baseline Constraint 56 / 89
  • 57. Change the UI Strings | String Resources 57 / 89
  • 58. Change the UI Strings | Translation Editor 58 / 89
  • 59. Properties | @string/edit_message (Remove text) 59 / 89
  • 61. Select Both | Center Horizontally 61 / 89
  • 62. A Chain Between the Two Views 62 / 89
  • 63. Button | Left & Right Margin ->16 63 / 89
  • 64. Text | Left Margin ->16 | Width Indicator -> Match Constraints 64 / 89
  • 66. Run & Test 66 / 89
  • 68. sendMessage() Method Stub | Alt + Enter -> Import class 68 / 89
  • 69. Connect sendMessage() to the Button 69 / 89
  • 70. app | Create a New Empty Activity 70 / 89
  • 75. Run & Test 75 / 89
  • 76. AVD - Landscape 76 / 89
  • 77. 77 / 89 Run & Test Real Device | SM-N750
  • 78. 78 / 89 Run & Test Real Device | SM-N750
  • 80. package com.example.em.exampleapplication01; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; public class MainActivity extends AppCompatActivity { public static final String EXTRA_MESSAGE = "com.example.em.exampleapplication01.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void sendMessage(View view) { Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.editText); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } } 80 / 89 MainActivity.java
  • 81. package com.example.em.exampleapplication01; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class DisplayMessageActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // Get the Intent that started this activity and extract the string Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Capture the layout's TextView and set the string as its text TextView textView = (TextView) findViewById(R.id.textView); textView.setText(message); } } 81 / 89 DisplayMessageActivity.java
  • 83. <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.em.exampleapplication01.MainActivity"> <EditText android:id="@+id/editText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:ems="10" android:hint="@string/edit_message" android:inputType="textPersonName" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintRight_toLeftOf="@+id/button" android:layout_marginLeft="16dp" /> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:onClick="sendMessage" android:text="@string/button_send" app:layout_constraintBaseline_toBaselineOf="@+id/editText" app:layout_constraintLeft_toRightOf="@+id/editText" app:layout_constraintRight_toRightOf="parent" /> </android.support.constraint.ConstraintLayout> 83 / 89 activity_main.xml
  • 84. <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.em.exampleapplication01.DisplayMessageActivity"> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:text="TextView" android:textAppearance="@style/TextAppearance.AppCompat.Display1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> 84 / 89 activity_display_message.xml
  • 86. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.em.exampleapplication01"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".DisplayMessageActivity" android:parentActivityName=".MainActivity" </application> </manifest> 86 / 89 AndroidManifest.xml
  • 88. Refs/Resources 1. Getting Started | Android Developers 2. Dashboards | Android Developers 3. Android Developer Fundamentals | Google Developers Training | Google Developers 4. Introduction - Android Developer Fundamentals Course - Practicals 88 / 89
  • 89. 89 / 89 ENDEueung Mulyana https://eueung.github.io/012017/android1 CodeLabs | Attribution-ShareAlike CC BY-SA