Posts

Showing posts from October, 2024

Broadcast Receiver in Android

Image
Hello friends hi. This post is regarding all about Broadcast Receiver in Android.  Broadcast Receiver is one of the four main component of Android application. So let's start... Broadcast Receivers   can send or receive messages  from other application or   from the system itself. These messages can be an event or an Intent.  For example:-    Android system sends broadcasts when system events occur such as system boots up, device starts charging low battery.   Furthermore , apps can send custom broadcasts to notify other apps( data download completed ). Apps can receive broadcasts in two ways: a)-   Manifest-declared receivers( Statically ) b)-   Context-registered receivers( Dynamically ) a)-   Manifest-declared receivers( Statically ):-   The registration is done in the manifest file, using   <register>   tags.  Firstly , specify the receiver in your manifest file. <receiver android:name=". MyBroadcas...

Android Services

Image
Hello friends hi. This post is regarding all about Service in Android. Service is one of the most important component of android application. In this post you will learn about the following points which is also the most important for any android interview...  1)- What is  Service? 2)- What are the types of Service? 3)- What is the difference between startService() and bindService()? 4)- What is IntentService and how it is differ from Service? 5)- Passing data between Activity and Service? 6)- What is Looper, Message Queue and Handler? So let's get start.... 1)- What is Service? The definition is very simple:- A service is an android component that perform long running operation in  background without providing the user interface. A service can run in background even if the user  switches to the another application. 2)- What are types of service? There are mainly three types of the service.... a)- Foreground Service b)- Background Service c)- Bound Service Let's dis...

All About Activity Launch Modes in Android

Image
Hello friends hi. This post is regarding all about activity launch modes. It is one the most confusing topic and night mare for the android developers. In this post you will learn about the following points which is also the most important for any android interview... 1)- What is launch modes? 2)- Types of launch modes? 3)- How to define launch modes? 4)- How does the onNewIntent() method works for different launch modes? 5)- What is the difference between singleTask and singleInstance? 6)- When would use singleTask launch mode? 7)- What are the common use  cases for each launch mode? So let's get start.... 1)- Here we must know what exactly the launch mode is? The answer is so simple  that the launch mode is an Android OS command that determines how an activity should be launched.  It specifies that how every new action would be linked to the new task (STACK). Now the question is what is a task and a back stack? *** When doing a job, user engage with a task, which is a s...

All about Android Activity

Image
 Hello friends hi. This post is regarding all about Android Activity. In this post you will learn about the following points... 1)- What is an activity? 2)- How is it works? 3)- what is its lifecycle? 4)- How to implement an activity? etc So let's get start.... So first question is What is an Activity in Android? The answer is quite simple, An Activity is an android component with a user interface with which a user can interact to it. On the other hands: An activity is a single screen in an application with which a user can interact to perform a task. It is similar to a window or a frame in a desktop application. An activity comes with their own lifecycle.  So now the question is what is the lifecycle of an activity? Life cycle of an activity determines how the activity will be Created, Started, Resumed, Paused, Stopped, Restarted and Destroyed. It consists of several methods. Here is the pictorial view of Activity lifecycle. above is the pictorial view of android activity lif...