0% found this document useful (0 votes)
69 views29 pages

01.1 Your First Android App

Uploaded by

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

01.1 Your First Android App

Uploaded by

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

Android Developer Fundamentals V2

Build your first


app
Lesson 1

This
Thiswork
workis islicensed
licensedunder
undera a
Your
Yourfirst
first
AndroidDeveloper
Android DeveloperFundamentals
FundamentalsV2
V2 Creative
CreativeCommons
CommonsAttribution
Attribution4.0
4.0Inter
Inter 1
Android
Androidappapp national
nationalLicense
License
1.1 Your first Android app

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 2
Android app national License
Contents

● Android Studio
● Creating "Hello World" app in Android Studio
● Basic app development workflow with Android Studio
● Running apps on virtual and physical devices

This work is licensed under a


Create your first
Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 3
Android app national License
Prerequisites
● Java Programming Language
● Object-oriented programming
● XML - properties / attributes
● Using an IDE for development and debugging

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 4
Android app national License
Android Studio

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 5
Android app national License
What is Android Studio?

● Android integrated development environment (IDE)


● Project and Activity templates
● Layout editor
● Testing tools
● Gradle-based build
● Log console and debugger
● Emulators

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 6
Android app national License
Android Studio interface

1. Toolbar
2. Navigation bar
3. Project pane
4. Editor
5. Tabs for other
panes

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 7
Android app national License
Installation Overview

● Mac, Windows, or Linux


● Download and install Android Studio from
https://developer.android.com/studio/
● See 1.1 P: Android Studio and Hello World

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 8
Android app national License
Creating your
first Android app

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 9
Android app national License
Start Android Studio

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 10
Android app national License
Create a project inside Android Studio

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 11
Android app national License
Name your app

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 12
Android app national License
Pick activity template
Choose templates for
common activities,
such as maps or
navigation drawers.

Pick Empty Activity


or Basic Activity for
simple and custom
activities.
Your first This work is licensed under a
Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 13
Android app national License
Name your activity
● Good practice:
○ Name main activity
MainActivity
○ Name layout
activity_main
● Use AppCompat
● Generating layout
file is convenient

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 14
Android app national License
Project folders
1. manifests—Android Manifest file -
description of app read by the
Android runtime
2. java—Java source code packages
3. res—Resources (XML) - layout,
strings, images, dimensions,
colors...
4. build.gradle—Gradle build files
Your first This work is licensed under a
Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 15
Android app national License
Gradle build system
● Modern build subsystem in Android Studio
● Three build.gradle:
○ project
○ module
○ settings

● Typically not necessary to know low-level Gradle details


● Learn more about gradle at https://gradle.org/
Your first This work is licensed under a
Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 16
Android app national License
Run your app
1. Run

2. Select virtual
or physical
device
3. OK
Your first This work is licensed under a
Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 17 17
Android app national License
Create a virtual device
Use emulators to test app on different versions of Android and form factors.

Tools > Android > AVD Manager or:

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 18
Android app national License
Configure virtual device

1. Choose hardware
2. Select Android version
3. Finalize

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 19
Android app national License
Run on a virtual device

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 20
Android app national License
Run on a physical device
1. Turn on Developer Options:
a. Settings > About phone
b. Tap Build number seven times
2. Turn on USB Debugging
a. Settings > Developer Options > USB Debugging
3. Connect phone to computer with cable

Windows/Linux additional setup:


● Using Hardware Devices

Windows drivers:
● OEM USB Drivers
Your first This work is licensed under a
Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 21
Android app national License
Get feedback as your app runs
1. Emulator
running the app
2. Run pane
3. Run tab to
open or close
the Run pane

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 22
Android app national License
Adding logging to your app

● As the app runs, the Logcat pane shows information


● Add logging statements to your app that will show up in the
Logcat pane
● Set filters in Logcat pane to see what's important to you
● Search using tags

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 23
Android app national License
The Logcat pane
1. Logcat tab to
show Logcat
pane
2. Log level menu

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 24
Android app national License
Logging statement
import android.util.Log;

// Use class name as tag


private static final String TAG =
MainActivity.class.getSimpleName();

// Show message in Android Monitor, logcat pane


// Log.<log-level>(TAG, "Message");
Log.d(TAG, “Creating the URI…”);
Your first This work is licensed under a
Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 25
Android app national License
Learn more

● Meet Android Studio


● Official Android documentation at developer.android.com
● Create and Manage Virtual Devices
● Supporting Different Platform Versions
● Supporting Multiple Screens

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 26
Android app national License
Learn even more

● Gradle Wikipedia page


● Google Java Programming Language style guide
● Find answers at Stackoverflow.com

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 27
Android app national License
What's Next?

● Concept Chapter: 1.1 Your first Android app


● Practical: 1.1 Android Studio and Hello World

Your first This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution 4.0 Inter 28
Android app national License
END

This work is licensed under a


Android Developer Fundamentals V2 Creative Commons Attribution-NonComm 29
ercial 4.0 International License

You might also like