Basic interview questions for android job

If you are a fresher in android development and preparing for very first interview in your life, then first of all CONGRATULATIONS and secondly I am here to help you with some basic knowledge and questions which might be asked in the interview. It is very important to know the answer of these question as a starter. These type of question is so popular, be sure that you are gonna asked it. So let’s get started.

What is the core building block in android:

There are 4 building blocks or component is available. The are:

  1. Activities
  2. Services
  3. Broadcast Receivers and
  4. Content Provider

What is Context?

Context is the state or current situation of an app in android. Context provides the access of the resources, local files, databases, shared preferences and many more.

What is Activity:

Activity is a single screen which contains views to interact in android app. It’s like a desktop application.

Draw the life cycle of an Activity:

This question is very important. Definitely you will be asked this question. Here is picture of a whole life cycle:

Differences between Fragment and Activity:

Remember, without an activity a fragment can not be inflated. Fragment is a part of Activity. An activity can contains multiple fragments.

What is ANR and when it appears?

ANR is application is not responding, It happens when an app stay unresponsive for more then 5 seconds.

What is Adapter?

Adapter is the messenger/connector between UI component and data sources. Android listview, gridview, spinner or recyclerview uses adapter.

What is SharedPreferences?

SharedPreferences is the class which stored data in xml format.

What is Intent?

Intent is the system to complete some particular task in android like activity transitions, broadcast listener or creating services.

How do you transfer data between 2 activites:

We can transfer data between 2 activities through intent using putExtra method. Another way is to use EventBus which is created by GreenRobot.

What is the differences between Interface and Abstract:

Abstract and interface very important in JAVA. You can not escape it. You will be asked about it.

need to be extended.Need to be implemented
can’t be initializedcan be initialized
contains abstract and non-
abstract methods
contains only abstract methods
should be used when similar classes exists. For example Dog and Cat classes have some similarities like both dog and cat have 4 legs, two ears. But their sounds are different. Cat sounds “meaow”, dog sounds “wuff”.
So both these classes can be extended from
Animal class and override the sound method.
interface is used to define the role or behavior of a class. It is also used to direct someone to write or design a class in specific way. Interface can be used to create event and listener.