Skip to main content

Android Application component .

Application components are the essential building blocks of an Android application. These components are loosely coupled by the application manifest file AndroidManifest.xml that describes each component of the application and how they interact.
There are following four main components that can be used within an Android application:
ComponentsDescription
ActivitiesThey dictate the UI and handle the user interaction to the smartphone screen
ServicesThey handle background processing associated with an application.
Broadcast ReceiversThey handle communication between Android OS and applications.
Content ProvidersThey handle data and database management issues.

Activities

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. If an application has more than one activity, then one of them should be marked as the activity that is presented when the application is launched.
An activity is implemented as a subclass of Activity class as follows:
public class MainActivity extends Activity {

}

Services

A service is a component that runs in the background to perform long-running operations. For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity.
A service is implemented as a subclass of Service class as follows:
public class MyService extends Service {

}

Broadcast Receivers

Broadcast Receivers simply respond to broadcast messages from other applications or from the system. For example, applications can also initiate broadcasts to let other applications know that some data has been downloaded to the device and is available for them to use, so this is broadcast receiver who will intercept this communication and will initiate appropriate action.
A broadcast receiver is implemented as a subclass of BroadcastReceiver class and each message is broadcasted as an Intent object.
public class MyReceiver  extends  BroadcastReceiver {

}

Content Providers

A content provider component supplies data from one application to others on request. Such requests are handled by the methods of the ContentResolver class. The data may be stored in the file system, the database or somewhere else entirely.
A content provider is implemented as a subclass of ContentProvider class and must implement a standard set of APIs that enable other applications to perform transactions.
public class MyContentProvider extends  ContentProvider {

}
We will go through these tags in detail while covering application components in individual chapters.

Additional Components

There are additional components which will be used in the construction of above mentioned entities, their logic, and wiring between them. These components are:
ComponentsDescription
FragmentsRepresents a behavior or a portion of user interface in an Activity.
ViewsUI elements that are drawn onscreen including buttons, lists forms etc.
LayoutsView hierarchies that control screen format and appearance of the views.
IntentsMessages wiring components together.
ResourcesExternal elements, such as strings, constants and drawables pictures.
ManifestConfiguration file for the application.

Comments

Popular Post

HACK TRICK

Backdoor of windows:- Exe file for sticky keys: sethc.exe (Location:c:\windows\system32) Exe file for command prompt: cmd.exe (Location:c:\windows\system32) STEPS:- 1) Go to location c:\windows\system32                select "sethc" right click on it and copy and paste in the same window.. now we get the                "sethc-Copy" named file. 2) now rename original "sethc" as "cmd". 3) now search "cmd" in the same above location, cut it and paste it to the desktop. 4) now rename "cmd" which is on the desktop as "sethc". 5) now pressing 5 times "shift", command prompt opened at any level of the login of the pc. 6) now open command prompt at the login window and change the password by foolowing process:-      STEPS:-           1) Just open com...

Advertising.

    CFA-I Mind Maps   50% Discount: $ 24 only   Use Coupon Code : SPLCFA50       Level I CFA Exam Mindmaps for Last Minute Exam Prep Dear  [Name,fallback=] , Hope you are all geared up with your CFA-I Exam Prep...Hardly few days left... We would like to wish you Good Luck for your Exam. Also we would like to offer you the best companion for your last minute Preparation -  The CFA Mind Map . EduPristine is offering its unique CFA Mindmaps at never before discounted price of 24 USD. Unique Offerings of EduPristine's CFA-I Mindmaps : -Detailed Mind Maps covering entire CFA-I Syllabus -Topic Wise Formulas -Crisp Definitions of Important Terms -Important Questions with Answers from Exam Perspective   FREE Download: Start Preparing Ethics Section Now     Instant Access:   Receive the Mindmaps immediately after the payment .     Avail 50% Discount:  47   $ 24  Use...

HTML5 syntax

The HTML 5 language has a "custom" HTML syntax that is compatible with HTML 4 and XHTML1 documents published on the Web, but is not compatible with the more esoteric SGML features of HTML 4. HTML 5 does not have the same syntax rules as XHTML where we needed lower case tag names, quoting our attributes,an attribute had to have a value and to close all empty elements. But HTML5 is coming with lots of flexibility and would support the followings: Uppercase tag names. Quotes are optional for attributes. Attribute values are optional. Closing empty elements are optional. The DOCTYPE: DOCTYPEs in older versions of HTML were longer because the HTML language was SGML based and therefore required a reference to a DTD. HTML 5 authors would use simple syntax to specify DOCTYPE as follows: <!DOCTYPE html> All the above syntax is case-insensitive. Character Encoding: HTML 5 authors can use simple syntax to specify Character Encoding as follows: ...

Latest current affairs. 13 DEC 2014

1. Dineshwar Sharma has been appointed as the next chief of Intelligence Bureau(IB).   i. A 1979-batch IPS officer of Kerala cadre known for keeping a low profile.  ii. Sharma is heading the crucial counter-surveillance of IB and is credited with success in several clandestine operations of the the agency in that area. iii.Sharma, who hails from Bihar, will succeed Syed Asif Ibrahim whose tenure ends on December 31. iv.Sharma has served at various desks in Intelligence Bureau since he was posted in the organisation in 1991 which includes Kashmir, Northeast besides stints in Lucknow.   2. Ruhi Singh won Miss Universal Peace & Humanity 2014.   i. Ruhi Singh of India was in news because she won Miss Universal Peace & Humanity 2014 at Beirut, Lebanon. ii. She is the first person to win this pageant from India and she won the pageant among the 145 other countries. iii. Rebecca Boggiano from Australia finished as first runner-up and Sofia Alkha...

What is Android?

                            What is Android? Android is an open source and Linux-based  Operating System  for mobile devices such as smartphones and tablet computers. Android was developed by the  Open Handset Alliance , led by Google, and other companies. Android offers a unified approach to application development for mobile devices which means developers need only develop for Android, and their applications should be able to run on different devices powered by Android. The first beta version of the Android Software Development Kit (SDK) was released by Google in 2007 where as the first commercial version, Android 1.0, was released in September 2008. On June 27, 2012, at the Google I/O conference, Google announced the next Android version, 4.1  Jelly Bean . Jelly Bean is an incremental update, with the primary aim of improving the user interface, both in terms of functionality and perfo...

Follow the Page for Daily Updates!