Skip to main content

What is the Core Building Blocks of Android?

The core building blocks or fundamental components of android are activities, views, intents, services, content providers, fragments and AndroidManifest.

Activity:

An activity is a class that represents a single screen in application.

View:

A view is the User Interface element such as button, label, text field etc. Anything that you see is a view.

Intent:

Intent is used to invoke components. It is mainly used to:

=> Start the service

=> Launch an activity

=> Display a web page

=> Display a list of contacts

=> Broadcast a message

=> Dial a phone call etc.

For Example:

    Intent intent=new Intent(Intent.ACTION_VIEW);  
    intent.setData(Uri.parse("https://moonyincoding.blogspot.com"));  
    startActivity(intent);   

Service:

Service is a background process that can run for a long time. 

Content Provider:

Content Providers are used to share data between the applications. 

Fragment:

Fragments are like parts of activity. An activity can display one or more fragments on the screen at the same time.

AndroidManifest

It contains informations about activities, content providers, permissions etc.

Comments

Popular posts from this blog

How to call Post type API using Retrofit in Android?

Step by Step Implementation Step 1: Create a New Project Step 2: Add the below dependency in your build.gradle file Navigate to the Gradle Scripts > build.gradle (Module:app) and add the below dependency in the dependencies section.  // below dependency for using the retrofit implementation ‘com.squareup.retrofit2:retrofit:2.9.0’ implementation ‘com.squareup.retrofit2:converter-gson:2.5.0’ After adding this dependency sync your project and now move towards the AndroidManifest.xml part.   Step 3: Adding permissions to the internet in the AndroidManifest.xml file Navigate to the app > AndroidManifest.xml and add the below code to it.  <!--permissions for INTERNET--> <uses-permission android:name="android.permission.INTERNET"/> Step 4: Working with the activity_main.xml file Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file.  <?xml version="1.0"...

How to call Post API using Retrofit in Android using Jetpack Compose?

Note: If you are seeking Java code for Jetpack Compose , please note that Jetpack Compose is only available in Kotlin . It uses features such as coroutines , and the handling of @Composable annotations is handled by a Kotlin compiler. There is no method for Java to access these. Therefore, you cannot use Jetpack Compose if your project does not support Kotlin. Step By Step Implementation Step 1: Create a New Project in Android Studio We demonstrated the application in Kotlin, so make sure you select Kotlin as the primary language while creating a New Project. Step 2: Add the below dependency to your build.gradle File Navigate to the Gradle Scripts > build.gradle (Module:app) and add the below dependency in the dependencies section.  // below dependency for using the retrofit implementation ‘com.squareup.retrofit2:retrofit:2.9.0’ implementation ‘com.squareup.retrofit2:converter-gson:2.5.0’ After adding this dependency sync your project and now move towards the AndroidManifes...

A Simple Data Binding Example

  Step-1: Enable data binding to android project ADD below line to your app level build.gradle file. android {     buildFeatures {         dataBinding = true     } }  Setp-2 : Add all your XML layout design inside this <layout></layout> tag <?xml version="1.0" encoding="utf-8"?> <layout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"> <androidx.constraintlayout.widget.ConstraintLayout     android:id="@+id/main"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context=".MainActivity">     <TextView         android:id="@+id/greeting_text_view"         android:layout_width="wrap_content"         android:lay...