SlideShare uma empresa Scribd logo
1 de 20
Application Building Blocks & Components

Android applications are composed of one or more application
components

- Activity
- Services
- Intents
- Content Providers
- Broadcast Receivers




                        Dept. of Computer Science and
                                  Engineering
Activity
• An activity corresponds to a screen. If an application is
  composed of several screens, it has an activity for each
  screen.

• Each activity is a class that extends the base class called
  Activity. It has a graphical user interface made of
  views, and it responds to events. When you change
  screen, a new activity is launched and It can return a
  value

• The graphical interface of an activity is described by a
  Layout              Dept. of Computer Science and
                           Engineering
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.




                           Dept. of Computer Science and
                                     Engineering
Application
• Create an application which calls one Activity
  into another




                  Dept. of Computer Science and
                            Engineering
Intent

• Intents are verbs for android devices, which defines actions
  and are made effective by a new screen
    E.g. CALL, SEND_MESSAGE.

• An intent is made up of an action and data that are URI.

• Components of an application — activities, services, and
  broadcast receivers , are activated through messages, called
  intents.

• In each case, the Android system finds the appropriate
  activity, service, or set of broadcast receivers to respond to
                          Dept. of Computer Science and
  the intent, instantiating them if necessary.
                                    Engineering
• Examples of actions: MAIN, VIEW, EDIT, PICK.

  If one wants to see a card about a person, an intent is defined. The
  action is VIEW and the data is the URI which enables access to this
  card.
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <action android:name="android.intent.action.EDIT" />
        <action android:name="android.intent.action.PICK" />
        <category android:name="android.intent.category.DEFAULT" />
        <data
        android:mimeType="vnd.android.cursor.dir/vnd.google.note" />
    </intent-filter>


                            Dept. of Computer Science and
                                      Engineering
IntentFilters

• Describes how the action should apply.
• To inform the system which implicit intents they can handle
  activities, services, and broadcast receivers


IntentReceiver

• It is an object that responds to external events. It can operate in the
  application or it can start an application.
• Example of intent, view a webpage: VIEW for action and for data
  http://www.linkToStuff.org.


                             Dept. of Computer Science and
                                       Engineering
Content Provider

• Data stored by a program, in the form of files or SQLite databases
  are private and may not be used by other applications.

• That is to say, a SQLite database created on Android by one
  application is usable only by that application, not by other
  applications. Databases created in Android are visible only to the
  application that created them

• So, if you need to share data between applications, you need to
  use the content provider.




                           Dept. of Computer Science and
                                     Engineering
For example,

• The Android system provides a content provider that manages the
  user's contact information. As such, any application with the proper
  permissions can query part of the content provider to read and
  write information about a particular person.

• Content providers are also useful for reading and writing data that is
  private to your application and not shared. For example, the Note
  Pad sample application uses a content provider to save notes.




                            Dept. of Computer Science and
                                      Engineering
To query a content provider, you provide a query string in the form of
a URI, with an optional specifier for a particular row, using the
following syntax:

<standard_prefix>://<authority>/<data_path>/<id>


Similarly, to retrieve all the contacts stored by the Contacts
application, the URI would look like this:

content://contacts/people




                            Dept. of Computer Science and
                                      Engineering
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.
• Applications can also initiate broadcasts—for example, to let
  other applications know that some data has been downloaded to
  the device and is available for them to use.
• Although broadcast receivers don't display a user interface, they
  may create a status bar notification to alert the user when a
  broadcast event occurs.


                         Dept. of Computer Science and
                                   Engineering
Services

• A service is a component that runs in the background to
  perform long-running operations . It’s a faceless
  component of a process.

• A service does not provide a user interface.

• A service is designed to operate independently of the
  screen, can update your data source and activities, and
  trigger specific notations.

• The best example is the music player that can work in
  background and when of Computer Science and in some other activity.
                     Dept. we can be
                               Engineering
Layouts



Dept. of Computer Science and
          Engineering
Types of Layout
•   Absolute Layout
•   Frame Layout
•   Linear Layout
•   Relative Layout
•   Table Layout




                      Dept. of Computer Science and
                                Engineering
AbsoluteLayout
• For each view you
  add, you specify the
  exact screen
  coordinate to display
  on the screen




                  Dept. of Computer Science and
                            Engineering
Frame Layout
• designed to display a
  single item at a time.
• element will be
  positioned based on
  the top left of the
  screen




                   Dept. of Computer Science and
                             Engineering
Linear Layout
• organizes elements along a single line.
• Can specify whether that line is vertical or
  horizontal using android:orientation.




                   Dept. of Computer Science and
                              android:orientation
                             Engineering            changed to horizontal.
Relative Layout
• lays out elements
  based on their
  relationships with one
  another, and with the
  parent container.




                  Dept. of Computer Science and
                            Engineering
Table Layout
• Organizes content into
  rows and columns.




                 Dept. of Computer Science and
                           Engineering
Tea Break




Come back at 4:00

   Dept. of Computer Science and
             Engineering

Mais conteúdo relacionado

Semelhante a Session 3 beccse

Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
Boom Shukla
 
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Itvedant
 

Semelhante a Session 3 beccse (20)

Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
 
Android Workshop Part 1
Android Workshop Part 1Android Workshop Part 1
Android Workshop Part 1
 
Embedded Systems.pdf
Embedded Systems.pdfEmbedded Systems.pdf
Embedded Systems.pdf
 
Android OS and its Features
Android OS and its FeaturesAndroid OS and its Features
Android OS and its Features
 
Introduction to Android Development.pptx
Introduction to Android Development.pptxIntroduction to Android Development.pptx
Introduction to Android Development.pptx
 
Android application development for TresmaxAsia
Android application development for TresmaxAsiaAndroid application development for TresmaxAsia
Android application development for TresmaxAsia
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
architecture of mobile software applications
architecture of mobile software applicationsarchitecture of mobile software applications
architecture of mobile software applications
 
Hello androidforyarlmeetup
Hello androidforyarlmeetupHello androidforyarlmeetup
Hello androidforyarlmeetup
 
Basics 4
Basics   4Basics   4
Basics 4
 
Synapseindia android apps overview
Synapseindia android apps overviewSynapseindia android apps overview
Synapseindia android apps overview
 
Mobile application development
Mobile application developmentMobile application development
Mobile application development
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Unit_1(Software and Software Engineering).pptx
Unit_1(Software and Software Engineering).pptxUnit_1(Software and Software Engineering).pptx
Unit_1(Software and Software Engineering).pptx
 
OOSE UNIT-1.pdf
OOSE UNIT-1.pdfOOSE UNIT-1.pdf
OOSE UNIT-1.pdf
 
5 applications bb
5   applications bb5   applications bb
5 applications bb
 
MoizChhatriwalaPotrfolio
MoizChhatriwalaPotrfolioMoizChhatriwalaPotrfolio
MoizChhatriwalaPotrfolio
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android Application
 
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
 
Final .pptx
Final .pptxFinal .pptx
Final .pptx
 

Último

Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 

Último (20)

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
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
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"
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 

Session 3 beccse

  • 1. Application Building Blocks & Components Android applications are composed of one or more application components - Activity - Services - Intents - Content Providers - Broadcast Receivers Dept. of Computer Science and Engineering
  • 2. Activity • An activity corresponds to a screen. If an application is composed of several screens, it has an activity for each screen. • Each activity is a class that extends the base class called Activity. It has a graphical user interface made of views, and it responds to events. When you change screen, a new activity is launched and It can return a value • The graphical interface of an activity is described by a Layout Dept. of Computer Science and Engineering
  • 3. 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. Dept. of Computer Science and Engineering
  • 4. Application • Create an application which calls one Activity into another Dept. of Computer Science and Engineering
  • 5. Intent • Intents are verbs for android devices, which defines actions and are made effective by a new screen E.g. CALL, SEND_MESSAGE. • An intent is made up of an action and data that are URI. • Components of an application — activities, services, and broadcast receivers , are activated through messages, called intents. • In each case, the Android system finds the appropriate activity, service, or set of broadcast receivers to respond to Dept. of Computer Science and the intent, instantiating them if necessary. Engineering
  • 6. • Examples of actions: MAIN, VIEW, EDIT, PICK. If one wants to see a card about a person, an intent is defined. The action is VIEW and the data is the URI which enables access to this card. <intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> </intent-filter> Dept. of Computer Science and Engineering
  • 7. IntentFilters • Describes how the action should apply. • To inform the system which implicit intents they can handle activities, services, and broadcast receivers IntentReceiver • It is an object that responds to external events. It can operate in the application or it can start an application. • Example of intent, view a webpage: VIEW for action and for data http://www.linkToStuff.org. Dept. of Computer Science and Engineering
  • 8. Content Provider • Data stored by a program, in the form of files or SQLite databases are private and may not be used by other applications. • That is to say, a SQLite database created on Android by one application is usable only by that application, not by other applications. Databases created in Android are visible only to the application that created them • So, if you need to share data between applications, you need to use the content provider. Dept. of Computer Science and Engineering
  • 9. For example, • The Android system provides a content provider that manages the user's contact information. As such, any application with the proper permissions can query part of the content provider to read and write information about a particular person. • Content providers are also useful for reading and writing data that is private to your application and not shared. For example, the Note Pad sample application uses a content provider to save notes. Dept. of Computer Science and Engineering
  • 10. To query a content provider, you provide a query string in the form of a URI, with an optional specifier for a particular row, using the following syntax: <standard_prefix>://<authority>/<data_path>/<id> Similarly, to retrieve all the contacts stored by the Contacts application, the URI would look like this: content://contacts/people Dept. of Computer Science and Engineering
  • 11. 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. • Applications can also initiate broadcasts—for example, to let other applications know that some data has been downloaded to the device and is available for them to use. • Although broadcast receivers don't display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs. Dept. of Computer Science and Engineering
  • 12. Services • A service is a component that runs in the background to perform long-running operations . It’s a faceless component of a process. • A service does not provide a user interface. • A service is designed to operate independently of the screen, can update your data source and activities, and trigger specific notations. • The best example is the music player that can work in background and when of Computer Science and in some other activity. Dept. we can be Engineering
  • 13. Layouts Dept. of Computer Science and Engineering
  • 14. Types of Layout • Absolute Layout • Frame Layout • Linear Layout • Relative Layout • Table Layout Dept. of Computer Science and Engineering
  • 15. AbsoluteLayout • For each view you add, you specify the exact screen coordinate to display on the screen Dept. of Computer Science and Engineering
  • 16. Frame Layout • designed to display a single item at a time. • element will be positioned based on the top left of the screen Dept. of Computer Science and Engineering
  • 17. Linear Layout • organizes elements along a single line. • Can specify whether that line is vertical or horizontal using android:orientation. Dept. of Computer Science and android:orientation Engineering changed to horizontal.
  • 18. Relative Layout • lays out elements based on their relationships with one another, and with the parent container. Dept. of Computer Science and Engineering
  • 19. Table Layout • Organizes content into rows and columns. Dept. of Computer Science and Engineering
  • 20. Tea Break Come back at 4:00 Dept. of Computer Science and Engineering

Notas do Editor

  1. Multiple Internet Mail extension