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

Most Important Topics. International , Science , UPSC, BPSC..

  International Relations Prev First in-Person Meeting of Quad Countries           Star marking (1-5) indicates the importance of topic for CSE Tags:  GS Paper - 2 Groupings & Agreements Involving India and/or Affecting India's Interests Why in News Recently, the first in-person meeting of  Quad  leaders was hosted by the US. Issues like climate change, Covid-19 pandemic and challenges in the Indo Pacific, amidst China's growing military presence in the strategic region, were discussed in the meeting. Key Points Background: In  November 2017, India, Japan, the US and Australia gave shape to the long-pending proposal of setting up the Quad  to develop a new strategy to keep the critical sea routes in the Indo-Pacific free of any influence. China claims nearly all of the disputed  South China Sea , though Taiwan, the Philippines, Brunei, Malaysia and Vietnam all claim parts of it. The South China Sea is an arm of the Western ...

### 🧠 Top 5 Artificial Intelligence News You Need to Know This Week

#### 1. Polish Language Leads in Complex AI Tasks A new global study has revealed that the Polish language outperformed all others, including English, in handling complex AI tasks. This finding highlights that artificial intelligence systems are becoming increasingly capable of understanding less commonly used languages. It also emphasizes the growing importance of developing AI tools that perform well across different linguistic and cultural contexts. #### 2. South Korea Pushes to Become a Global AI Powerhouse In a bold move to strengthen its AI ecosystem, South Korea has introduced tax relief measures for nearly 5,000 AI startups. The initiative aims to make the country one of the top three global AI leaders. This step not only encourages innovation but also shows how government policies can shape the future of artificial intelligence and emerging technologies. #### 3. AI Helps Police Solve Crimes Faster A police department in the United States has started using a new AI tool to anal...
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- srportalgiri_main_AdSense1_250x250_as --> <ins class="adsbygoogle"      style="display:inline-block;width:250px;height:250px"      data-ad-client="ca-pub-2060990885270177"      data-ad-slot="4129699440"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>

UPSC MCQ

Consider the following statements: 1. Polavaram Project is a multi-purpose irrigation project. 2. It is a dam located across Krishna River. 3. The dam is located in Telangana state. Which of the above written statements is/are true? Choose the correct code from the options given below: A. 1 only B. 3 only C. 1 and 2 D. 2 and 3 Explanation : Polavaram Project is a dam located across Godavari River, located in Andhra Pradesh. It was accorded national project status as part of the legislation bifurcating Andhra Pradesh in 2014. Recently, the Ministry of Water Resources (MoWR), National Water Development Agency (NWDA) and National Bank for Agriculture and Rural Development (NABARD) signed a fresh Memorandum of Agreement (MOA) to provide for a total Rs 1,400 crore as part of the central share. Which of the following statements regarding military exercises is/are correct? 1. Coordinated Patrol (CORPAT) is bilateral naval exercise held between India and Indonesia. 2. Rim of ...

Oil report

The United Nations (UN) on 18 December 2014 sent a team of international experts to help Bangladesh in cleaning up the Sundarbans oil spill. The team belonging to the United Nations Disaster Assessment and Coordination (UNDAC) was sent on a request from Bangladesh government. The UN team will help Bangladesh government in the ground work and will also conduct an assessment and advise on recovery and risk reduction measures. The team comprises of experts from Britain, European Union, France and the United States. Besides, the UN asked Dhaka to impose a complete ban on the movement of commercial vessels through the Sundarbans.

Follow the Page for Daily Updates!