Android has evolved over the years and quickly become the dominant mobile platform across the globe. Android holds over 72% of the global mobile OS market share as of May 2021, according to StatCounter. Android developer is one of the most popular tech jobs in the IT industry. Preparing for one can be a headache, as Android development broads into 100s of topics, and covering all of them will require plenty of time. We have gathered top questions asked during top MNCs technical interview rounds for hiring an Android developer to reduce your workload. Here are some Top Android Interview Questions for Tech Jobs.
There are currently 32,000+ jobs in the United States offering an average salary of $119,692 per year.
Top Android developer job Interview Questions
1. What Is the Android Manifest?
Every app project must have an
AndroidManifest.xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.
2. What are the features of Android architecture?
Android architecture is a software stack of components to support mobile device needs. Android software stack contains a Linux Kernel, a collection of c/c++ libraries which are exposed through an application framework services, runtime, and application.
Following are the main components of android architecture those are
- Android Framework
- Android Runtime
- Platform Libraries
- Linux Kernel
In these components, the Linux Kernel is the main component in android to provide its operating system functions to mobile and Dalvik Virtual Machine (DVM) which is responsible for running a mobile application.
3. What Is the Google Android SDK?
Android SDK is a software development kit developed by Google for the Android platform. The Android SDK allows you to create Android apps, and you don’t need to be an expert to use it.
Android SDK comes bundled with Android Studio, Google’s official integrated development environment (IDE) for the Android operating system.
4. What is an activity?
An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with
setContentView(View). While activities are often presented to the user as full-screen windows, they can also be used in other ways: as floating windows (via a theme with
R.attr.windowIsFloating set), Multi-Window mode or embedded into other windows.
5. What is an activity lifecycle?
Activities in the system are managed as activity stacks. When a new activity is started, it is usually placed on the top of the current stack and becomes the running activity — the previous activity always remains below it in the stack, and will not come to the foreground again until the new activity exits. There can be one or multiple activity stacks visible on screen.
The following diagram shows the important state paths of an Activity. The square rectangles represent callback methods you can implement to perform operations when the Activity moves between states. The colored ovals are major states the Activity can be in.
6. What is AAPT?
AAPT allows you to view, create, and update ZIP-compatible archives (ZIP, JAR, and APK). It can also compile resources into binary assets. It is the base builder for Android applications.
7. What is the use of an activityCreator?
An activity Creator is the initial step for creation of a new Android project. It consists of a shell script used to create a new file system structure required for writing codes in Android IDE. It was replaced by Create New Project.
8. What is the use of Bundle in Android?
Bundles are generally used for passing data between various Android activities. It depends on you what type of values you want to pass, but bundles can hold all types of values and pass them to the new activity.
You can use it like this:
Intent intent = new... Intent(getApplicationContext(), SecondActivity.class); intent.putExtra("myKey", AnyValue); startActivity(intent);
You can get the passed values by doing:
Bundle extras = intent.getExtras(); String tmp = extras.getString("myKey");
9. What is Fragment and its lifecycle?
A Fragment is a part of application’s user interface that is bound to an activity. Fragments have their lifecycle and layouts or UI components. Fragments help enrich your UI design, pass data between different screens, and adapt to different device configurations.
Each Fragment instance has its own lifecycle. When a user navigates and interacts with your app, your fragments transition through various stages in their lifecycle as they are added, removed, and enter or exit the screen.
To manage the lifecycle,
LifecycleOwner, exposing a
Lifecycle object that you can access through the
Lifecycle state is represented in the
10. What are “launch modes”?
Launch mode is an instruction for Android OS which specifies how the activity should be launched. It instructs how any new activity should be associated with the current task.
There are four launch modes for activity. They are:
4. Single Instance
In the AndroidManifest you can use “launchMode” attribute inside the <activity> element to declare the activity’s launch mode like-
<activity android:launchMode = [“standard” | “singleTop” | “singleTask” | “singleInstance”] ../>
11. When should you use a Fragment rather than an Activity?
- When you have some UI components to be used across various activities
- When multiple view can be displayed side by side just like viewPager
12. What is Retained Fragment?
By default, Fragments are destroyed and recreated along with their parent Activity’s when a configuration change occurs. Calling setRetainInstance(true) allows us to bypass this destroy-and-recreate cycle, signaling the system to retain the current instance of the fragment when the activity is recreated.
13. What is a View in Android?
View is a basic building block of UI (User Interface) in android. A view is a small rectangular box that responds to user inputs. Eg: EditText, Button, CheckBox, etc. ViewGroup is an invisible container of other views (child views) and other ViewGroup. Eg: LinearLayout is a ViewGroup that can contain other views in it.
14. What are ViewGroups and how they are different from the Views?
- View: View objects are the basic building blocks of User Interface(UI) elements in Android. View is a simple rectangle box which responds to the user’s actions. Examples are EditText, Button, CheckBox etc. View refers to the android.view.View class, which is the base class of all UI classes.
- ViewGroup: ViewGroup is the invisible container. It holds View and ViewGroup. For example, LinearLayout is the ViewGroup that contains Button(View), and other Layouts also. ViewGroup is the base class for Layouts.
15. What is a Canvas?
The Canvas class holds the “draw” calls. To draw something, you need 4 basic components: A Bitmap to hold the pixels, a Canvas to host the draw calls (writing into the bitmap), a drawing primitive (e.g. Rect, Path, text, Bitmap), and a paint (to describe the colors and styles for the drawing).
16. Relative Layout vs Linear Layout.
Linear Layout means you can align views one by one (vertically/ horizontally).
Relative Layout means based on the relation of views from its parents and other views.
ContraintLayout is similar to a RelativeLayout in that it uses relations to position and size widgets, but has additional flexibility and is easier to use in the Layout Editor.
17. What is a Toast in Android?
A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. Toasts automatically disappear after a timeout.
18. What is an Intent?
An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and Context.startService(Intent) or Context.bindService(Intent, ServiceConnection, int) to communicate with a background Service.
19. What is a Service?
A Service is an application component that can perform long-running operations in the background. It does not provide a user interface. Once started, a service might continue running for some time, even after the user switches to another application. Additionally, a component can bind to a service to interact with it and even perform interprocess communication (IPC). For example, a service can handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background.
20. How to persist data in an Android app?
There are multiple ways to store data in an android app
- Shared Preferences
- Internal storage
- External storage
- SQLite databases
- Saving cache files
These Top Android Interview Questions will. surely help you to crack your interview.