A good Android developer should have good knowledge of Android Fundamentals. If you have an interview for the position of the Android developer, you should expect the Android programming interview questions that I am going to share in the post below. Do not forget to bookmark this page as this might help you in future as well 🙂
1. What is Android?
Android is a Linux kernel based Operating System that is primarily used on Smartphones, tablets, smartwatches, LEDs, and Cameras.
2. What is Android SDK?
Android SDK is a toolset which includes source code, libraries, emulator and development tools. It is essential for the building Android Application using Java Programming Language.
3. What is Android NDK?
Android NDK is a toolset that allows you to use languages such as C and C++ for the implementation of parts of your app in native code.
4. What does the Android Architecture consist of?
Android Architecture consists of Linux Kernel, Android Framework, Android Applications, and Libraries.
5. What is the Android Framework?
Android Framework is a framework which consists of all the classes and methods required to develop Android Applications.
6. What is the difference between asset folder and res folder?
Res folder contains the resource files whose format is supported by Android while asset folder contains resource files whose format is not supported by Android (Eg. *.mp3 etc).
7. Main Basic Building Blocks of Android:
- Content Providers
- Broadcast receivers
8. What is an Activity?
An activity represents a single screen with a user interface.
9. What is Activity Lifecycle?
Activity goes through different states during the navigation by the user. There are seven methods of Activity Lifecycle:
onCreate() (called when the activity is starting)
onStart() ( called after onCreate() and called after onRestart()
onResume() (called after onPause() and OnRestart()
onPause() (When the activity is partially visible to the user)
onStop() (When the activity is no longer visible to the user)
onRestart() (When the activity is re-displayed to the user after onStop() is called)
onDestroy() (Called before the activity is destroyed)
10. What is a Service?
It is an application component that runs in the background without interacting with the user. It is used for handling long running operations. (Example: Downloading from the Internet etc.)
11. What is a content provider?
A content provider is an application component that provides data to the application stored by itself or stored by the other apps.
12. What is a Content resolver?
A content resolver is a global instance in your application that provides access to Content Providers in your and other applications.
13. What are broadcast receivers?
A broadcast receiver is an Android Component which can be registered for a system or application events. These are notified by the Android runtime when these events occur.
14. What is Intent?
The intent is a messaging object that is used for communication between the Android components. A user can request an action by using an intent. The fundamental uses of an Intent are:
- Starting an Activity
- Starting a Service
- Delivering Broadcast Messages
15. What is an explicit intent?
It is an intent in which you specify the app component that you need to start. (Example: Starting a specific Activity in your App, Starting a specific service from the App etc.)
16. What is an Implicit Intent?
It is an intent in which no app component is specified to perform an action. Only the action is declared and the component from the app capable of performing that action handles it. (Example: Playing a Music File, Opening a URL etc.)
17. What is an Intent Filter?
An intent filter is a specification in the app’s manifest file in which the types of intents are specified that the components can respond to.
18. What is a Pending Intent?
A pending intent is an intent which specifies an action to be performed in future. (example alarm)
19. What is a Broadcast Message?
A message sent by the System to the App. (Example: Battery Low Message, Device charging Message, etc)
20. What is a Fragment?
A Fragment is a layout that represents a part of UI of an activity.
21. Difference between Activity and Fragment:
An activity can contain 0 or multiple fragments. Fragments can’t exist independently. Fragments can be reused in different activities.
22. What is Foreground service?
A service which can be viewed and allowed by the user to take any action on it. (Example: Music being played in the background)
23. How to implement a Service that gets restarted itself after being killed?
Override onStartCommand() method of Service class and return ‘Service.START_STICKY’ in it.
24. What is a Local Broadcast Manager?
Helper class to register and send broadcast messages
25. What is Gradle?
Setting up all tools and libraries is time-consuming. Android introduced a powerful build system, called Gradle. It offers better library management and builtin APK support.
With Gradle, we have Build variant (represents different versions of the app that you can build) and different packages and Keystore credentials for paid and unpaid version.
Note: Any changes in the gradle will reflect in the whole IDE.
26. What is Proguard?
Proguard is a code optimizer that shrinks APK size. It removes unusable code and makes it hard to reverse engineer the APK.
27. What is Firebase?
Firebase is a mobile platform by Google to help developers develop a high-quality app and grow their base. It offers Crash reports, analytics, real-time communication and AdMob support.
28. What is Retrofit?
A rest type client in Android which converts your JSON format or XML into POJOs defined by you.
29. Which new features were introduced in Android Marshmallow(6.0)?
- Doze: It is a feature that saves battery life by restricting system activities when the device is in a stationary position for time.
- Separate permissions: App will ask for the permissions individually when it will be required to be accessed for the first time. Particular permissions can be either granted or denied from the App settings.
30. Which new features were introduced in Android Noughat(7.0)?
- Doze and go: It is a feature that saves battery life by restricting system activities when the screen is off, even if it is not in stationary position.
- Multi support window: It allows users to use multiple applications on a single screen.
31. What are the new major features in Android Oreo (8.0)?
- Picture in Picture Mode: It is a multi-window mode which is mostly used for video playback.
- Adaptive icons: Support for App launcher icons with visual effects.
- New Notification System: User can see notifications attached to the app launcher icons. The notifications can also be snoozed.
32. What is Material design?
Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. To use material design in your Android apps, follow the guidelines described in the material design specification and use the new components and functionality available in Android 5.0 (API level 21).
33. What is a Manifest file?
Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest file provides essential information about your app to the Android system, which the system must have before it can run any of the app’s code.
34. What is a Handler?
A Handler allows you to send and process Message and Runnable objects associated with a thread’s MessageQueue. Each Handler instance is associated with a single thread and that thread’s message queue.
There are two main uses for a Handler: (1) to schedule messages and runnables to be executed at some point in the future; and (2) to enqueue an action to be performed on a different thread than your own.
35. What is GSON?
GSON is a Java Library that can convert Java Objects into JSON Objects.
36. What is Mipmap?
Mipmap is a pre-calculated, optimized sequence of images, each of which is a progressively lower resolution representation of the same image
37. What are Nine patch images?
These are bitmap images that automatically resize to accommodate the contents of the view and the size of the screen. Selected parts of the image are scaled horizontally or vertically based on indicators drawn within the image.
38. What is Snackbar in Android?
It is an android component displays the message to the user and offers the ability to the user to perform an action.
39. Dp and sp:
DP(Density Pixels): based on physical density of the screen
SP(Scale Pixels): based on screen density and user’s font size preference both.
40. What is an AsyncTask?
AsyncTask is an abstract class in Android which allows handling background tasks and publish the result o the UI thread.
41. Thread vs Asynctask:
UI thread cannot be accessed through threads (you are required to use a handler if you want to update UI from a Thread). It is preferred for long-running background tasks. While Asynctask is a good choice for short running background tasks and publishing results on UI thread.
42. How many AsyncTasks can run at a time?
128 but threadPoolExecuter will create 5 threads only. Rest Asynctasks will be queued.
43. What is a Thread pool executer?
It is an ExecutorService that executes each submitted task using one of possibly several pooled threads, normally configured using Executors factory methods.
Thread pools address two different problems: they usually provide improved performance when executing large numbers of asynchronous tasks, due to reduced per-task invocation overhead, and they provide a means of bounding and managing the resources, including threads, consumed when executing a collection of tasks. Each ThreadPoolExecutor also maintains some basic statistics, such as the number of completed tasks.
44. Which design patterns are used in android?
I hope the above android interview questions will prove to be useful for you. If you like it, share it with your friends to whom you feel it will be useful. Best of Luck!