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

Lesson 1 Final

The document discusses Android app development. It states that Android is the world's most popular mobile platform, with over 2 billion active devices worldwide. It introduces some key concepts for Android app development, including activities which define what the app does, and layouts which define the appearance of each screen. The document also mentions that additional resources like images and sound files can be included in apps. It provides an overview of setting up development and building a basic Android app with Android Studio.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Lesson 1 Final

The document discusses Android app development. It states that Android is the world's most popular mobile platform, with over 2 billion active devices worldwide. It introduces some key concepts for Android app development, including activities which define what the app does, and layouts which define the appearance of each screen. The document also mentions that additional resources like images and sound files can be included in apps. It provides an overview of setting up development and building a basic Android app with Android Studio.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Pengenalan

Android

Lesson 1

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 1


Welcome to Androidville
●Android is the world’s most popular mobile platform.
●At the last count, there were over two billion active Android devices
worldwide, and that number is growing rapidly.
●Android is a comprehensive open source platform based on Linux and
championed by Google.
●It’s a powerful development framework that includes everything you
need to build great apps using a mix of Java and XML.
●What’s more, it enables you to deploy those apps to a wide variety of
devices—phones, tablets, and more.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 2


Layouts define what each screen looks like
●A typical Android app is Layouts
composed of one or more tell
Android
screens. what the
●You define what each screen screens in
your app
looks like using a layout to look like
define its appearance.
●Layouts are usually defined in
XML, and can include GUI
components such as buttons,
text fields, and labels.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 3


Activities define what the app does
• Layouts only define the appearance of
the app.
• You define what the app does using one
or more activities.
• An activity is a special Java class that
decides which layout to use and tells the
app how to respond to the user.
• As an example, if a layout includes a
button, you need to write Java code in the
activity to define what the button should Activities
define
do when you press it. what the
app
should do.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 4


Sometimes extra resources are needed too
● In addition to activities and layouts, Android
apps often need extra resources such as
image files and application data.
● You can add any extra files you need to the
app.
● Android apps are really just a bunch of files in
particular directories.
● When you build your app, all of these files get
bundled together, giving you an app you can
run on your device. Resources
can
include
sound and
image
Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 5
files.
The Android platform dissected

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 6


Here’s what we’re going to do
1. Set up a development environment.
We need to install Android Studio, which includes
all the tools you need to develop Android apps.
2. Build a basic app.
We’ll build a simple app using Android Studio that
will display some sample text on the screen.
3. Run the app in the Android emulator.
We’ll use the built-in emulator to see the app up
and running.
4. Change the app.
Finally, we’ll make a few tweaks to the app we
created in step 2, and run it again.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 7


The Android SDK
The Android Software Development Kit contains the libraries and tools you
need to develop Android apps. Here are some of the main points:
SDK Platform Documentation
There’s one of these for So you can access the latest
each version of Android. API documentation offline.

SDK Tools Android Support


Tools for debugging and testing, plus Extra APIs that aren’t available
other useful utilities. The SDK also in the standard platform.
features a set of platform dependent D K
dS
tools.
droi
An
Sample apps
Google Play Billing
If you want practical code examples to
Allows you to integrate billing
help you understand how to use some of
services in your app.
the APIs, the sample apps might help you.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 8


Install Android Studio
First, check the Android Studio system requirements here: Google
sometimes
http://developer.android.com/sdk/index.html#Requirements
changes their
Then follow the Android Studio installation instructions here: URLs. If these
https://developer.android.com/sdk/installing/index.html?pkg=studio URLs don’t
work, search
for Android
Studio and
This is the you should
Android find them.
Studio
welcome
screen. It
includes a set
of options for
things you
can do.
Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 9
Build a basic app
This is the
name of the This is a very simple
application. app, but that’s all you
need for your very first
Android app.

There’ll be a
small piece of
sample text right
here that Android
Studio will put in
for us.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 10


Create a new project

Click on this option


to start a new
Android Studio
project.

Any projects you


create will appear
here. This is our first
project, so this area
is currently empty.
Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 11
Configure the project
The application name is shown in the Google Play Store and
various other places, too.
The wizard forms the
package name by
combining the
Use a company
application name
domain of
and the company
Uncheck the option to include C++ hfad.com.
domain.
support. If prompted, also uncheck the
option to include Kotlin support.

All of the files for your project will


be stored here.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 12


Specify the minimum SDK

The minimum
required SDK is the
lowest version your
app will support.
Your app
will run on devices
with this level API or
higher. It won’t run
on devices with a
lower API.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 13


Activities and layouts
●An activity is a single, defined thing that your user can
do. You might have an activity to compose an email, take
a photo, or find a contact. Activities are usually associated
with one screen, and they’re written in Java.
●A layout describes the appearance of the screen.
Layouts are written as XML files and they tell Android how
the different screen elements are arranged.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 14


Activities and layouts
● Layout define how the user interface is presented.
● Activities define actions
1
<Layout>
2
1. The device launches your app and creates an
</Layout>
activity object. <Layout>

2. The activity object specifies a layout. 3 </Layout>


Activity
Device
3. The activity tells Android to display the layout
onscreen.
4. The user interacts with the layout that’s displayed on
the device.
4
5. The activity responds to these interactions by 5
running application code.
6. The activity updates the display...
7. ...which the user sees on the device. 6
7 Activity
User Device

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 15


Add an activity

There are other


types of activity
you can choose
from, but for this
exercise make
sure you select
the Empty
Activity option.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 16


Customize the activity

Name the activity


“MainActivity” and
the layout
“activity_main”. Also
make sure the option
to generate the
Uncheck the Backwards
layout is checked.
Compatibility
(AppCompat) option.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 17


Project in Android Studio

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 18


Click on the arrow

Folder Structure
here and choose the
Project option to see
the files and folders
that make up your
This is the
project.
name of
the project.

Click
These files on
and folders these
are all arrow
included in s to
expa
your nd or
project. colla
pse
the
folder
s.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 19


Useful files in your project

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 20


Edit code with the Android Studio editors – Code Editor

Double-click on
the file in the
explorer and the
file contents
appear in the
editor panel.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 21


Edit code with the Android Studio editors – Design Editor

You dictate
which
editor
you’re You can edit layouts using the
using with visual editor by dragging and
these tabs. dropping components.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 22


activity_main.xml

Make the layout the


same width and height
as the screen size on
the device.

Add padding to the


screen margins.

Include a <TextView>
GUI component for
displaying text.
Make the GUI component
just large enough for its
content.
Display the String “Hello
World!”

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 23


MainActivity.java
This is the
package name.
These are Android
classes used in
MainActivity.
MainActivity extends the
Android class
android.app.Activity.
Implement the
onCreate() method from
the Activity class. This
method is called when
the activity is first
Specify which layout to
created.
use.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 24


Run the app in the Android emulator
• The Android emulator allows you to run
your app on an Android virtual device
(AVD), which behaves just like a physical
Android device.
• You can set up numerous AVDs, each
emulating a different type of device.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 25


Open the Android Virtual Device
Manager

Click on this
button to
create an
AVD.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 26


Select the hardware

When you
select a
device, its
details
appear here.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 27


Select a system image

If you don’t
have this
system image
installed,
you’ll be
given the
option to
download it.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 28


Verify the AVD configuration

Your Nexus 5X AVD has


been created.

These are the


options you chose
over the past few
pages.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 29


Compile, package, deploy, and run
An APK file is an Android application
package. It’s basically a JAR or ZIP file for
Android applications.
1. The Java source files get compiled to
bytecode.
2. An Android application package, or APK file,
gets created.
3. Assuming there’s not one already running,
the emulator gets launched and then runs
the AVD.
4. Once the emulator has been launched and
the AVD is active, the APK file is uploaded to
the AVD and installed.
5. The AVD starts the main activity associated
with the app.

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 30


You can watch progress in the console

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 31


Test drive

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 32


END

Pemrograman Mobile Ronny Makhfuddin Akbar, S.Kom, M.Kom 33

You might also like