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
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
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
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