Application Building Blocks & ComponentsAndroid applications are composed of one or more applicationcomponents- Activity- ...
Activity• An activity corresponds to a screen. If an application is  composed of several screens, it has an activity for e...
For example,An email application might have one activity that shows a list ofnew emails, another activity to compose an em...
Application• Create an application which calls one Activity  into another                  Dept. of Computer Science and  ...
Intent• Intents are verbs for android devices, which defines actions  and are made effective by a new screen    E.g. CALL,...
• Examples of actions: MAIN, VIEW, EDIT, PICK.  If one wants to see a card about a person, an intent is defined. The  acti...
IntentFilters• Describes how the action should apply.• To inform the system which implicit intents they can handle  activi...
Content Provider• Data stored by a program, in the form of files or SQLite databases  are private and may not be used by o...
For example,• The Android system provides a content provider that manages the  users contact information. As such, any app...
To query a content provider, you provide a query string in the form ofa URI, with an optional specifier for a particular r...
Broadcast receivers• A broadcast receiver is a component that responds to system-  wide broadcast announcements.• Many bro...
Services• A service is a component that runs in the background to  perform long-running operations . It’s a faceless  comp...
LayoutsDept. of Computer Science and          Engineering
Types of Layout•   Absolute Layout•   Frame Layout•   Linear Layout•   Relative Layout•   Table Layout                    ...
AbsoluteLayout• For each view you  add, you specify the  exact screen  coordinate to display  on the screen               ...
Frame Layout• designed to display a  single item at a time.• element will be  positioned based on  the top left of the  sc...
Linear Layout• organizes elements along a single line.• Can specify whether that line is vertical or  horizontal using and...
Relative Layout• lays out elements  based on their  relationships with one  another, and with the  parent container.      ...
Table Layout• Organizes content into  rows and columns.                 Dept. of Computer Science and                     ...
Tea BreakCome back at 4:00   Dept. of Computer Science and             Engineering
Upcoming SlideShare
Loading in …5
×

Session 3 beccse

174
-1

Published on

Android Workshop PPt's

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
174
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Multiple Internet Mail extension
  • Session 3 beccse

    1. 1. Application Building Blocks & ComponentsAndroid applications are composed of one or more applicationcomponents- Activity- Services- Intents- Content Providers- Broadcast Receivers Dept. of Computer Science and Engineering
    2. 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. 3. For example,An email application might have one activity that shows a list ofnew emails, another activity to compose an email, and anotheractivity for reading emails. Dept. of Computer Science and Engineering
    4. 4. Application• Create an application which calls one Activity into another Dept. of Computer Science and Engineering
    5. 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. 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. 7. IntentFilters• Describes how the action should apply.• To inform the system which implicit intents they can handle activities, services, and broadcast receiversIntentReceiver• 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. 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. 9. For example,• The Android system provides a content provider that manages the users 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. 10. To query a content provider, you provide a query string in the form ofa URI, with an optional specifier for a particular row, using thefollowing syntax:<standard_prefix>://<authority>/<data_path>/<id>Similarly, to retrieve all the contacts stored by the Contactsapplication, the URI would look like this:content://contacts/people Dept. of Computer Science and Engineering
    11. 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 dont 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. 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. 13. LayoutsDept. of Computer Science and Engineering
    14. 14. Types of Layout• Absolute Layout• Frame Layout• Linear Layout• Relative Layout• Table Layout Dept. of Computer Science and Engineering
    15. 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. 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. 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. 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. 19. Table Layout• Organizes content into rows and columns. Dept. of Computer Science and Engineering
    20. 20. Tea BreakCome back at 4:00 Dept. of Computer Science and Engineering
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×