Weitere ähnliche Inhalte Ähnlich wie Android Studio Tutorial For Beginners | Android Tutorial | Android Training | Edureka (20) Kürzlich hochgeladen (20) Android Studio Tutorial For Beginners | Android Tutorial | Android Training | Edureka2. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Agenda
✓ What is Android Studio?
✓ Android Stack
✓ Installation
✓ What is an Activity?
✓ Activity Life Cycle
✓ Event Listeners
✓ Intents
✓ Demo
3. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What is Android Studio?
4. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What is Android Studio?
Android studio is an official IDE for developing android applications
➢ Free and Simple
➢ Open source
➢ Written in Java
➢ Integrated gradle build system
5. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Android Stack
6. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Android Stack
7. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Android Stack
8. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Android Stack
9. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Installation
Now, let’s see the installation of Android Studio
10. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Installation - JDK
Go to the link :
http://www.oracle.com/techn
etwork/java/javase/download
s/jdk8-downloads-
2133151.html
And download JDK.
11. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Installation - Android Studio
Go to the link :
https://developer.android.c
om/studio/index.html
Download latest
Android Studio 2.3.2
1
2
12. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What is an Activity?
13. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What is an Activity?
It serves as an entry point for user’s interaction.
Each activity has a layout file where you can place your UI.
An application can have different activities.
An Activity is the screen representation of any application in Android
14. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Features of an Activity
➢ All activities interact with the user in order to do something, such as
dial the phone, take a photo, send an email, or view a map.
➢ Activities are presented as floating windows or embedded
inside another activity.
15. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Features of an Activity
➢ An application consists of multiple activities that are loosely bound to each other
16. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Activity Life Cycle
17. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Activity Life Cycle
18. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Activity Life Cycle
In this case the activity is
destroyed and removed
from the memory
In this state, the
activity is created.
Activity is in the
foreground and the user
can interact with it.
Activity is partially
obscured by another
activity. The other activity
that's in the foreground is
semi-transparent.
Activity is completely
hidden and not visible to
the user.
Create
Resumed (running state)
Stopped
Paused
Destroy
19. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Event Listeners
Let’s look at various event listeners in an activity
20. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Event Listeners
An event listener is an interface in the View class that contains a single callback method.
These are the tickets to capture the user interaction with your UI.
This is called when the user either touches the item when in touch mode.
onClick()
This is called when the user navigates onto or away from the item, using the navigation-keys or
trackball.
onFocusChange()
1
2
21. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Event Listeners
onLongClick()
onKey()
onTouch()
The user either touches and holds the item when in touch mode. Say it holds the suitable "enter" key
and holds down on the trackball (for one second).
This is called when the user is focused on the item and presses or releases a hardware key on the
device.
This is called when the user performs an action qualified as a touch event, including a press, a
release, or any movement gesture on the screen (within the bounds of the item).
3
4
5
23. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Intents
An intent is a messaging object you can use to request
an action from another app component.
➢ Methods are used to deliver intents to different
components:
• context.startActivity()
• context.startService()
• context.sendBroadcast()
24. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Intents
An intent can carry data bundle to perform any activity
For example if an activity has to launch an email operation, we can use an
intent with ACTION_SEND.
Types of Intent:
Implicit Intent
Explicit Intent
1
2
25. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Implicit Intent
Implicit intent is when the target component is not defined in the intent and the android
system has to evaluate the registered components based on the intent data.
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.edureka.co"));
startActivity(i);
Action Specification
26. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Explicit Intent
Explicit intent is when an application defines the target component directly in the
intent.
Intent i = new Intent(this, ActivityTwo.class);
i.putExtra("Value1", "This is ActivityTwo ");
i.putExtra("Value2", "This value two for ActivityTwo");
startActivity(i);
Target component