SlideShare une entreprise Scribd logo
1  sur  40
Android
mobilių programėlių kūrimo įvadas
Application Fundamentals
- Android applications are written in the
Java programming language.
- The Android operating system is a
multi-user Linux system in which each
application is a different user.
- Each process has its own virtual
machine (VM), so an application's code
runs in isolation from other applications.
Application Components
- There are four different types of application components. Each type serves a
distinct purpose and has a distinct lifecycle that defines how the component is
created and destroyed:

- Activity
- Service
- Content provider
- Broadcast receiver
Activity
An activity represents a single screen with a
user interface. For example, an email
application might have one activity that
shows a list of new emails, another activity to
compose an email, and another activity for
reading emails.
Activity Lifecycle




A representation of how each new activity in a task adds an item to the back
stack. When the user presses the Back button, the current activity is destroyed
and the previous activity resumes.
Activity Lifecycle
onCreate() - Called when the activity is first created. This
is where you should do all of your normal static set up —
create views, bind data to lists, and so on.

onRestart() - Called after the activity has been stopped,
just prior to it being started again.

onStart() - Called just before the activity becomes visible
to the user.

onResume() - Called just before the activity starts
interacting with the user.
Activity Lifecycle
onPause() - Called when the system is about to start
resuming another activity. This method is typically used
to commit unsaved changes to persistent data, stop
animations and other things that may be consuming
CPU, and so on. It should do whatever it does very
quickly, because the next activity will not be resumed
until it returns.

onStop() - Called when the activity is no longer visible to
the user.

onDestroy() - Called before the activity is destroyed. This
is the final call that the activity will receive.
Fragment
A Fragment represents a behavior or a
portion of user interface in an Activity. You
can combine multiple fragments in a single
activity to build a multi-pane UI and reuse a
fragment in multiple activities.
Fragment Lifecycle
onAttach() - Called when the fragment has been
associated with the activity.

onCreate() - The system calls this when creating the
fragment.

onCreateView() - The system calls this when it's time for
the fragment to draw its user interface for the first time.

onActivityCreated() - Called when the activity's
onCreate() method has returned.

onStart(), onResume() - Same as Activity.
Fragment Lifecycle
onPause() - The system calls this method as the first
indication that the user is leaving the fragment (though it
does not always mean the fragment is being destroyed).

onStop() - Called when the Fragment is no longer started.

onDestroyView() - Called when the view hierarchy
associated with the fragment is being removed.

onDestroy() - Called when the fragment is no longer in
use.

onDetach() - Called when the fragment is being
disassociated from the activity.
Service
A Service is an application component that can perform
long-running operations in the background and does not
provide a user interface.

Started - A service is "started" when an application
component (such as an activity) starts it by calling
startService().

Bound - A service is "bound" when an application
component binds to it by calling bindService().

A service runs in the main thread of its hosting process -
the service does not create its own thread and does not
run in a separate process (unless you specify otherwise).
Content Provider
A content provider manages access to a central
repository of data. A provider is part of an Android
application, which often provides its own UI for working
with the data.

Decide if you need a content provider. You need to build
a content provider if you want to provide one or more of
the following features:
- You want to offer complex data or files to other
applications.
- You want to allow users to copy complex data from your
app into other apps.
- You want to provide custom search suggestions using
the search framework.
Broadcast receivers
A broadcast receiver is a
component that responds to
system-wide broadcast
announcements. Many
broadcasts originate from the
system—for example, a
broadcast announcing that the
screen has turned off, the
battery is low, or a picture was
captured.
Intents and Intent Filters



Three of the core components of an application - activities,
services, and broadcast receivers - are activated through
messages, called intents.
User Interface
All user interface elements in an
Android app are built using View
and ViewGroup objects.

A View is an object that draws
something on the screen that the
user can interact with.

A ViewGroup is an object that
holds other View (and
ViewGroup) objects in order to
define the layout of the interface.
User Interface
All user interface elements in an
Android app are built using View
and ViewGroup objects.

A View is an object that draws
something on the screen that the
user can interact with.

A ViewGroup is an object that
holds other View (and
ViewGroup) objects in order to
define the layout of the interface.
Linear Layout
LinearLayout is a view group that aligns all
children in a single direction, vertically or
horizontally. You can specify the layout direction
with the android:orientation attribute.
Linear Layout Example
All children of a LinearLayout are
stacked one after the other, so a
vertical list will only have one
child per row, no matter how wide
they are, and a horizontal list will
only be one row high (the height
of the tallest child, plus padding).
Relative Layout
RelativeLayout is a view group that displays child
views in relative positions. The position of each
view can be specified as relative to sibling
elements (such as to the left-of or below another
view) or in positions relative to the parent
RelativeLayout area (such as aligned to the
bottom, left of center).
Relative Layout Example
RelativeLayout lets child views
specify their position relative to
the parent view or to each other
(specified by ID). So you can
align two elements by right
border, or make one below
another, centered in the screen,
centered left, and so on. By
default, all child views are drawn
at the top-left of the layout, so you
must define the position of each
view using the various layout
properties available from
RelativeLayout.LayoutParams.
List View
ListView is a view group that displays a list of
scrollable items. The list items are automatically
inserted to the list using an Adapter that pulls
content from a source such as an array or
database query and converts each item result
into a view that's placed into the list.
Grid View
GridView is a ViewGroup that displays items in a
two-dimensional, scrollable grid. The grid items
are automatically inserted to the layout using a
ListAdapter.
Input Controls
Input controls are the interactive components in
your app's user interface. Android provides a
wide variety of controls you can use in your UI,
such as buttons, text fields, seek bars,
checkboxes, zoom buttons, toggle buttons, and
many more.
Buttons


          Depending on whether you
          want a button with text, an
          icon, or both, you can
          create the button in your
          layout in three ways.
Text Fields
Input controls are the interactive components in
your app's user interface. Android provides a
wide variety of controls you can use in your UI,
such as buttons, text fields, seek bars,
checkboxes, zoom buttons, toggle buttons, and
many more.
Text Fields
You can specify the type of keyboard you want for your EditText
object with the android:inputType attribute.

There are several different input types available for different
situations. Here are some of the more common values for
android:inputType:

"text" - Normal text keyboard.
"textEmailAddress" -Normal text keyboard with the @ character.
"textUri" - Normal text keyboard with the / character.
"number" - Basic number keypad.
"phone" - Phone-style keypad.
Checkboxes / Radio Buttons
Checkboxes allow the user to select one or more
options from a set. Typically, you should present
each checkbox option in a vertical list.




Radio buttons allow the user to select one option
from a set. You should use radio buttons for
optional sets that are mutually exclusive if you
think that the user needs to see all available
options side-by-side.
Setup IDE

      http://developer.android.com/tools/
Create Android project
Create Android project
Android project structure
            src – Java code

            assets – external files

            libs – external libraries

            res – application resources

            AndroidManifest.xml – the "manifest" file
MainActivity.java
activity_main.xml / strings.xml
Hello world Result
Create Result Activity Manifest file
Create Result Activity
Update Main Activity
Update Main Activity
Update Main Activity
Q&A
v.valkaitis@appcamp.lt

Contenu connexe

Tendances

Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
Ahsanul Karim
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
Ahsanul Karim
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI Widgets
Ahsanul Karim
 
Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivity
Ahsanul Karim
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViews
Ahsanul Karim
 
How to create ui using droid draw
How to create ui using droid drawHow to create ui using droid draw
How to create ui using droid draw
info_zybotech
 

Tendances (20)

Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
 
Android UI Fundamentals part 1
Android UI Fundamentals part 1Android UI Fundamentals part 1
Android UI Fundamentals part 1
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
 
Lecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile AppsLecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile Apps
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 
Android Lesson 2
Android Lesson 2Android Lesson 2
Android Lesson 2
 
Android UI Patterns
Android UI PatternsAndroid UI Patterns
Android UI Patterns
 
Android development session 3 - layout
Android development   session 3 - layoutAndroid development   session 3 - layout
Android development session 3 - layout
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI Widgets
 
Android MapView and MapActivity
Android MapView and MapActivityAndroid MapView and MapActivity
Android MapView and MapActivity
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViews
 
Building a simple user interface lesson2
Building a simple user interface lesson2Building a simple user interface lesson2
Building a simple user interface lesson2
 
Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3Android Workshop: Day 1 Part 3
Android Workshop: Day 1 Part 3
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Android Widget
Android WidgetAndroid Widget
Android Widget
 
How to create ui using droid draw
How to create ui using droid drawHow to create ui using droid draw
How to create ui using droid draw
 
Android Screen Containers & Layouts
Android Screen Containers & LayoutsAndroid Screen Containers & Layouts
Android Screen Containers & Layouts
 

En vedette

Presentatie 5febr [autosaved]
Presentatie 5febr [autosaved]Presentatie 5febr [autosaved]
Presentatie 5febr [autosaved]
Kim Raes
 
презентация ооо оптэлко
презентация ооо оптэлкопрезентация ооо оптэлко
презентация ооо оптэлко
neevinata
 
Suson eye specialists_guide_new
Suson eye specialists_guide_newSuson eye specialists_guide_new
Suson eye specialists_guide_new
John Suson
 
Top 10 Comparison Shopping Engines
Top 10 Comparison Shopping EnginesTop 10 Comparison Shopping Engines
Top 10 Comparison Shopping Engines
Convertro
 
Automatic light project
Automatic light projectAutomatic light project
Automatic light project
kspece0928
 
Turkey vs pakistan (1)
Turkey vs pakistan (1)Turkey vs pakistan (1)
Turkey vs pakistan (1)
Chandni Saleem
 

En vedette (14)

Presentatie 5febr [autosaved]
Presentatie 5febr [autosaved]Presentatie 5febr [autosaved]
Presentatie 5febr [autosaved]
 
Eric ittah
Eric ittahEric ittah
Eric ittah
 
Hipertensión arterial
Hipertensión arterialHipertensión arterial
Hipertensión arterial
 
Ai
AiAi
Ai
 
Info avond 1oktober Stand van zaken hopmarktproject (vzw AHA)
Info avond 1oktober Stand van zaken hopmarktproject (vzw AHA)Info avond 1oktober Stand van zaken hopmarktproject (vzw AHA)
Info avond 1oktober Stand van zaken hopmarktproject (vzw AHA)
 
презентация ооо оптэлко
презентация ооо оптэлкопрезентация ооо оптэлко
презентация ооо оптэлко
 
RELESTED.PDF
RELESTED.PDFRELESTED.PDF
RELESTED.PDF
 
Suson eye specialists_guide_new
Suson eye specialists_guide_newSuson eye specialists_guide_new
Suson eye specialists_guide_new
 
"Android" mobilių programėlių kūrimo įvadas #4
"Android" mobilių programėlių kūrimo įvadas #4"Android" mobilių programėlių kūrimo įvadas #4
"Android" mobilių programėlių kūrimo įvadas #4
 
Top 10 Comparison Shopping Engines
Top 10 Comparison Shopping EnginesTop 10 Comparison Shopping Engines
Top 10 Comparison Shopping Engines
 
Automatic light project
Automatic light projectAutomatic light project
Automatic light project
 
hipertensión arterial
hipertensión arterial hipertensión arterial
hipertensión arterial
 
mutual funds of pakistan
mutual funds of pakistanmutual funds of pakistan
mutual funds of pakistan
 
Turkey vs pakistan (1)
Turkey vs pakistan (1)Turkey vs pakistan (1)
Turkey vs pakistan (1)
 

Similaire à "Android" mobilių programėlių kūrimo įvadas #2

Android application model
Android application modelAndroid application model
Android application model
magicshui
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
Ahsanul Karim
 
行動App開發管理實務 unit2
行動App開發管理實務 unit2行動App開發管理實務 unit2
行動App開發管理實務 unit2
Xavier Yin
 

Similaire à "Android" mobilių programėlių kūrimo įvadas #2 (20)

Nativa Android Applications development
Nativa Android Applications developmentNativa Android Applications development
Nativa Android Applications development
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android 101 Session @thejunction32
Android 101 Session @thejunction32Android 101 Session @thejunction32
Android 101 Session @thejunction32
 
Android app development
Android app developmentAndroid app development
Android app development
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-
 
Android application model
Android application modelAndroid application model
Android application model
 
Android Jumpstart Jfokus
Android Jumpstart JfokusAndroid Jumpstart Jfokus
Android Jumpstart Jfokus
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
Beginning android
Beginning android Beginning android
Beginning android
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentals
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
 
行動App開發管理實務 unit2
行動App開發管理實務 unit2行動App開發管理實務 unit2
行動App開發管理實務 unit2
 

Dernier

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 

Dernier (20)

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

"Android" mobilių programėlių kūrimo įvadas #2

  • 2. Application Fundamentals - Android applications are written in the Java programming language. - The Android operating system is a multi-user Linux system in which each application is a different user. - Each process has its own virtual machine (VM), so an application's code runs in isolation from other applications.
  • 3. Application Components - There are four different types of application components. Each type serves a distinct purpose and has a distinct lifecycle that defines how the component is created and destroyed: - Activity - Service - Content provider - Broadcast receiver
  • 4. Activity An activity represents a single screen with a user interface. For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails.
  • 5. Activity Lifecycle A representation of how each new activity in a task adds an item to the back stack. When the user presses the Back button, the current activity is destroyed and the previous activity resumes.
  • 6. Activity Lifecycle onCreate() - Called when the activity is first created. This is where you should do all of your normal static set up — create views, bind data to lists, and so on. onRestart() - Called after the activity has been stopped, just prior to it being started again. onStart() - Called just before the activity becomes visible to the user. onResume() - Called just before the activity starts interacting with the user.
  • 7. Activity Lifecycle onPause() - Called when the system is about to start resuming another activity. This method is typically used to commit unsaved changes to persistent data, stop animations and other things that may be consuming CPU, and so on. It should do whatever it does very quickly, because the next activity will not be resumed until it returns. onStop() - Called when the activity is no longer visible to the user. onDestroy() - Called before the activity is destroyed. This is the final call that the activity will receive.
  • 8. Fragment A Fragment represents a behavior or a portion of user interface in an Activity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities.
  • 9. Fragment Lifecycle onAttach() - Called when the fragment has been associated with the activity. onCreate() - The system calls this when creating the fragment. onCreateView() - The system calls this when it's time for the fragment to draw its user interface for the first time. onActivityCreated() - Called when the activity's onCreate() method has returned. onStart(), onResume() - Same as Activity.
  • 10. Fragment Lifecycle onPause() - The system calls this method as the first indication that the user is leaving the fragment (though it does not always mean the fragment is being destroyed). onStop() - Called when the Fragment is no longer started. onDestroyView() - Called when the view hierarchy associated with the fragment is being removed. onDestroy() - Called when the fragment is no longer in use. onDetach() - Called when the fragment is being disassociated from the activity.
  • 11. Service A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Started - A service is "started" when an application component (such as an activity) starts it by calling startService(). Bound - A service is "bound" when an application component binds to it by calling bindService(). A service runs in the main thread of its hosting process - the service does not create its own thread and does not run in a separate process (unless you specify otherwise).
  • 12. Content Provider A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. Decide if you need a content provider. You need to build a content provider if you want to provide one or more of the following features: - You want to offer complex data or files to other applications. - You want to allow users to copy complex data from your app into other apps. - You want to provide custom search suggestions using the search framework.
  • 13. Broadcast receivers A broadcast receiver is a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured.
  • 14. Intents and Intent Filters Three of the core components of an application - activities, services, and broadcast receivers - are activated through messages, called intents.
  • 15. User Interface All user interface elements in an Android app are built using View and ViewGroup objects. A View is an object that draws something on the screen that the user can interact with. A ViewGroup is an object that holds other View (and ViewGroup) objects in order to define the layout of the interface.
  • 16. User Interface All user interface elements in an Android app are built using View and ViewGroup objects. A View is an object that draws something on the screen that the user can interact with. A ViewGroup is an object that holds other View (and ViewGroup) objects in order to define the layout of the interface.
  • 17. Linear Layout LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. You can specify the layout direction with the android:orientation attribute.
  • 18. Linear Layout Example All children of a LinearLayout are stacked one after the other, so a vertical list will only have one child per row, no matter how wide they are, and a horizontal list will only be one row high (the height of the tallest child, plus padding).
  • 19. Relative Layout RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements (such as to the left-of or below another view) or in positions relative to the parent RelativeLayout area (such as aligned to the bottom, left of center).
  • 20. Relative Layout Example RelativeLayout lets child views specify their position relative to the parent view or to each other (specified by ID). So you can align two elements by right border, or make one below another, centered in the screen, centered left, and so on. By default, all child views are drawn at the top-left of the layout, so you must define the position of each view using the various layout properties available from RelativeLayout.LayoutParams.
  • 21. List View ListView is a view group that displays a list of scrollable items. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database query and converts each item result into a view that's placed into the list.
  • 22. Grid View GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a ListAdapter.
  • 23. Input Controls Input controls are the interactive components in your app's user interface. Android provides a wide variety of controls you can use in your UI, such as buttons, text fields, seek bars, checkboxes, zoom buttons, toggle buttons, and many more.
  • 24. Buttons Depending on whether you want a button with text, an icon, or both, you can create the button in your layout in three ways.
  • 25. Text Fields Input controls are the interactive components in your app's user interface. Android provides a wide variety of controls you can use in your UI, such as buttons, text fields, seek bars, checkboxes, zoom buttons, toggle buttons, and many more.
  • 26. Text Fields You can specify the type of keyboard you want for your EditText object with the android:inputType attribute. There are several different input types available for different situations. Here are some of the more common values for android:inputType: "text" - Normal text keyboard. "textEmailAddress" -Normal text keyboard with the @ character. "textUri" - Normal text keyboard with the / character. "number" - Basic number keypad. "phone" - Phone-style keypad.
  • 27. Checkboxes / Radio Buttons Checkboxes allow the user to select one or more options from a set. Typically, you should present each checkbox option in a vertical list. Radio buttons allow the user to select one option from a set. You should use radio buttons for optional sets that are mutually exclusive if you think that the user needs to see all available options side-by-side.
  • 28. Setup IDE http://developer.android.com/tools/
  • 31. Android project structure src – Java code assets – external files libs – external libraries res – application resources AndroidManifest.xml – the "manifest" file
  • 35. Create Result Activity Manifest file