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

Current affairs

Narendra Ambwani elected as chairman of the Advertising Standards Council of India (ASC Published on: 13-SEP-2014 Important for Exam:  6 people agreed Narendra Ambwani on 12 September 2014 elected as Chairman of the Advertising Standards Council of India (ASCI). SBI celebrated 150 years of its operations in Sri Lanka Published on: 13-SEP-2014 Important for Exam:  6 people agreed State Bank of India (SBI) on 13 September 2014 celebrated 150 years of its operations in Sri Lanka. West Bengal cabinet cleared farmer-friendly project Sech-Bandhu Prakalpa to boost irrigation Published on: 13-SEP-2014 Important for Exam:  8 people agreed The West Bengal cabinet on 12 September 2014 cleared a farmer-friendly project named  Sech-Bandhu Prakalpa  to boost irrigation. Delhi Government to charge cess of one rupee on cigarette and liquor to promote public tra Published on: 13-SEP-2014 Important for Exam:  5 people agreed ...

📍 DIFFERENCE BETWEEN FDI and FPI

  DIFFERENCE BETWEEN FDI and FPI #Stockmarket 💡 FDI is involved in setting up firms to produce goods and services. That is why it is called 'direct' institution. FPI on the other hand buys financial assets for profits. In order to remove the ambiguity that prevails on what is Foreign Direct Investment (FDI) and what is Foreign Institutional Investment (FII), it was decided to follow the international practice and lay down a broad principle that, where an investor has a stake of 10 percent or less in a company, it will be treated as FII and, where an investor has a stake of more than 10 percent, it will be treated as FDI. 💡 Since the source of funds is not revealed, the PNs are potentially unsafe. Therefore, SEBI imposed certain conditions like limits on the PNs that a single FII can issue, etc. SEBI wants the PN holders to register with SEBI and invest directly as India is a long-term growth story. SEBI policy paid off with the number of FIIs registering with the regulator go...

■ Can India Become A Technology Leader? India

  ■ Can India Become A Technology Leader?   ✅India is presently not a major player in the field of technology due to certain challenges and on the other side, there are many celebrated Indian technologists around the world as many of the technology giants choose an India- born techie as their leader. ✅The conversation around Indian executives at the helm of top tech companies has gathered some momentum with Parag Agrawal taking over as Twitter CEO. The major technology companies like Google and its parent company Alphabet, Microsoft and Twitter, Adobe and IBM are all headed by Indians. ● The Case of the U.S: ✅The Indian immigrants in the U.S are the part of the most educated and professionally accomplished communities in that country. ✅As of 2019, there were 2.7 million Indian immigrants in the U.S. ✅The government of the U.S has been instrumental in the triumphs of enterprise and the free market. ✅The governmental agencies have been actively supporting the research and develo...

World famous event

1. Walmart to open new store in India after 2-year gap  i. After a gap of two years, US retail major Walmart will open a new cash and carry store in Agra as it returns focus on India.  ii. The company, which opened its last store in Bhopal towards the end of 2012, has said it will focus on cash and carry business in India in the absence of clarity on FDI in multi-brand retail trade. iii. "Walmart is committed to India and we are focused on our growth plans... We have recently received all internal approvals for opening a new store in Agra, our second one in the city," Walmart spokesperson told PTI. 2. Jyotsna Suri elected as the President of the FICCI i. Jyotsna Suri, Chairperson of Bharat Hotels, on 20 December 2014 was elected as the President of the Federation of Indian Chambers of Commerce & Industry (FICCI). ii. Suri succeeded Sidharth Birla. iii. Alok B Shriram, deputy managing director of DCM Shriram Industries Ltd, assumed the charge of the presid...

Serial Blasts In SRI LANKA

Serial blasts across Sri Lanka Mains-GS-3-Security 1. Over 200 people were killed and nearly 500 injured in a series of blasts that shook Sri Lanka on Easter Sunday. 2. Churches and luxury hotels were targeted in the deadliest incidents since the civil war ended a decade ago. 3. Eight blasts occurred in and around the capital Colombo and in the eastern city of Batticaloa when large groups gathered at churches for Easter services. 4. Most of the blasts appear to have been suicide bombings. No group has claimed responsibility for the blasts. 5. Investigating authorities in Sri Lanka are yet to disclose the names of the suspects or the alleged perpetrators. 6. The scale and savagery of the attacks that clearly targeted Christians have left Sri Lankans devastated. Curb on Social Media 1. Sri Lankan law enforcement have urged the public to stay indoors following series of blasts. 2. Sri Lankan government blocked social media platforms like Facebook and Instagram to prevent the sp...

Follow the Page for Daily Updates!