Android Developer

60+ Android Developer Interview Questions and Answers for Freshers

Updated 13 Jan 2025
search-icon

Q1. Cube Sum Pairs Problem Statement

Given a positive integer N, find the number of ways to express N as a sum of cubes of two integers, A and B, such that:

N = A^3 + B^3

Ensure you adhere to the following conditio...read more

Q2. BST Iterator Problem Statement

You are tasked with creating a class named BSTIterator that acts as an iterator for the inorder traversal of a binary search tree. Implement the following functions:

  1. BSTIterator(...read more

Q3. Integer to Roman Conversion

Given an integer N, convert it to its corresponding Roman numeral representation. Roman numerals comprise seven symbols: I, V, X, L, C, D, and M.

Example:

Input:
N = 2
Output:
II
Exp...read more

Q4. Colorful Knapsack Problem

You are given a set of 'N' stones, each with a specific weight and color. The goal is to fill a knapsack with exactly 'M' stones, choosing one stone of each color, so that the total we...read more

Are these interview questions helpful?

Q5. What is Android development

Ans.

Android development is the process of creating applications for the Android operating system.

  • Android development involves writing code in Java or Kotlin to create mobile applications.

  • It includes designing user interfaces, implementing functionality, and testing the app.

  • Developers use Android Studio, an integrated development environment (IDE), for building Android apps.

  • Android apps can be published on the Google Play Store and run on various devices.

  • Examples of Android apps i...read more

Q6. What is use of activity creator

Ans.

The activity creator is used to create instances of an activity class in Android development.

  • The activity creator is responsible for instantiating an activity class.

  • It is typically used when starting a new activity from another activity.

  • The activity creator can pass data to the new activity through intent extras.

  • It is commonly used in the onCreate() method of the calling activity.

  • Example: Intent intent = new Intent(this, SecondActivity.class); startActivity(intent);

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. Puzzel : There are 4 persons (A,B,C, and D) who wants to cross a bridge in night . A takes 1 minute to cross the bridge. B takes 2 minutes to cross the bridge. C takes 5 minute to cross the bridge. D takes 10 m...

read more
Ans.

Minimum time required to cross the bridge is 17 minutes.

  • A and B cross (2 minutes), A returns (1 minute), C and D cross (10 minutes), B returns (2 minutes), A and B cross (2 minutes).

  • Always send the fastest person back to minimize time.

  • Total time taken is the sum of all individual crossing times.

Q8. What is Dependency Injection, and how does Hilt facilitate its implementation in Android development?

Ans.

Dependency Injection is a design pattern where components are given their dependencies rather than creating them.

  • Hilt is a dependency injection library for Android that simplifies the implementation of DI in Android apps.

  • Hilt generates the necessary classes for DI at compile time, reducing boilerplate code.

  • Hilt provides annotations like @HiltAndroidApp, @AndroidEntryPoint, and @Inject to facilitate DI in Android development.

Android Developer Jobs

Android Developer 4-6 years
Capgemini Technology Services India Limited
3.7
Mumbai
Android Developer 4-7 years
Infosys Limited
3.6
Bangalore / Bengaluru
Android Developer 5-9 years
Infosys Technologies ltd
3.6
Bangalore / Bengaluru

Q9. How to know that what things people want From a phone?

Ans.

To know what things people want from a phone, conduct market research, analyze user feedback, track industry trends, and consider user demographics.

  • Conduct market research to understand consumer preferences

  • Analyze user feedback from reviews, surveys, and forums

  • Track industry trends and technological advancements

  • Consider user demographics and their specific needs

  • Examples: larger battery life, better camera quality, faster performance

Q10. What is the difference b/w constraint layout & relative layout?

Ans.

Constraint layout is more flexible and efficient than relative layout.

  • Constraint layout allows for complex layouts with fewer nested views.

  • It uses constraints to position and size views relative to other views or parent layout.

  • Relative layout positions views relative to each other or parent layout using attributes like 'above', 'below', etc.

  • Constraint layout is recommended for complex layouts with many views.

  • Relative layout is recommended for simple layouts with few views.

Q11. On which lifecycle event, the view is attached to the Fragment?

Ans.

The view is attached to the Fragment during the onAttach() lifecycle event.

  • The onAttach() method is called when the Fragment is associated with its host Activity.

  • This is the first lifecycle method called after the Fragment is created.

  • The onAttach() method receives the Activity as a parameter, allowing the Fragment to interact with its host.

Q12. What is LazyColumn in Jetpack Compose and how is it used?

Ans.

LazyColumn is a vertically scrolling list that only composes and lays out the items that are visible on the screen.

  • LazyColumn is part of Jetpack Compose, a modern Android UI toolkit.

  • It is used to efficiently display large lists of items by only rendering the items that are currently visible on the screen.

  • LazyColumn is similar to RecyclerView in traditional Android development.

  • It automatically recycles items as they scroll off the screen, improving performance and reducing mem...read more

Q13. How do you find a missing element in an array?

Ans.

To find a missing element in an array, iterate through the array and compare each element with a range of expected values.

  • Sort the array if it is unsorted.

  • Iterate through the array and compare each element with a range of expected values.

  • If an element is missing, return it.

  • If no element is missing, return null or -1.

Q14. How to set the view in the middle in ContraintLayout?

Ans.

To set a view in the middle in ConstraintLayout, use layout_constraintStart_toStartOf, layout_constraintEnd_toEndOf, layout_constraintTop_toTopOf, and layout_constraintBottom_toBottomOf attributes.

  • Use layout_constraintStart_toStartOf and layout_constraintEnd_toEndOf to align horizontally in the middle.

  • Use layout_constraintTop_toTopOf and layout_constraintBottom_toBottomOf to align vertically in the middle.

  • Set both horizontal and vertical constraints to center the view.

Q15. What is the concept of Object-Oriented Programming (OOP)?

Ans.

OOP is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.

  • OOP focuses on creating objects that interact with each other to solve problems.

  • Objects have attributes (data) and methods (functions) that define their behavior.

  • Encapsulation, inheritance, and polymorphism are key principles of OOP.

  • Example: In a banking application, a 'Customer' object could have attributes like name and account balan...read more

Q16. What is the purpose of the Modifier in Jetpack Compose?

Ans.

Modifiers in Jetpack Compose are used to apply styling, layout, and behavior to UI elements.

  • Modifiers are used to modify the appearance, layout, and behavior of UI elements in Jetpack Compose.

  • They can be used to add padding, alignment, background color, click listeners, and more to UI elements.

  • Modifiers are composable functions that can be chained together to create complex UI layouts.

  • Examples of modifiers include padding(), background(), clickable(), and align().

Q17. Explain features of Android development

Ans.

Android development features include open-source platform, rich development environment, and extensive libraries.

  • Open-source platform allows for customization and flexibility

  • Rich development environment with tools like Android Studio

  • Extensive libraries for various functionalities like UI, networking, and database

  • Support for multiple hardware devices and screen sizes

  • Integration with Google services like Maps, Firebase, and Play Store

  • Ability to create interactive and engaging u...read more

Q18. What is java

Ans.

Java is a high-level programming language used for developing a wide range of applications, including Android apps.

  • Java is an object-oriented language.

  • It is platform-independent, meaning it can run on any operating system.

  • Java uses a virtual machine called the Java Virtual Machine (JVM) to execute code.

  • It has a large standard library with built-in classes and methods for common programming tasks.

  • Java is known for its simplicity, readability, and robustness.

Frequently asked in, ,

Q19. Have you worked with ViewPager2 and ListAdapter?

Ans.

Yes, I have experience working with ViewPager2 and ListAdapter.

  • Implemented ViewPager2 to create swipeable screens in Android apps.

  • Utilized ListAdapter to efficiently manage data for RecyclerViews.

  • Used ListAdapter's DiffUtil to efficiently update RecyclerView items.

Q20. What are the components of the Android App?

Ans.

The components of an Android app include activities, services, broadcast receivers, and content providers.

  • Activities: UI components that represent a single screen with a user interface.

  • Services: Background tasks that run independently of the UI.

  • Broadcast Receivers: Respond to system-wide broadcast announcements.

  • Content Providers: Manage a shared set of app data.

Q21. Write syntax for HashMap in Kotlin and Java and put some values.

Ans.

Syntax for HashMap in Kotlin and Java with values.

  • In Kotlin:

  • val hashMap = hashMapOf<String, Int>()

  • hashMap.put("key1", 1)

  • hashMap.put("key2", 2)

  • In Java:

  • HashMap<String, Integer> hashMap = new HashMap<>();

  • hashMap.put("key1", 1);

  • hashMap.put("key2", 2);

Q22. What are the basics of Kotlin coroutines?

Ans.

Kotlin coroutines are a way to perform asynchronous operations in a sequential manner.

  • Coroutines are lightweight threads that can be used to perform long-running tasks without blocking the main thread.

  • They can be used to simplify asynchronous programming by allowing developers to write code that looks synchronous.

  • Coroutines can be launched using 'launch' or 'async' functions.

  • They can be cancelled using 'cancel' function.

  • Example: 'GlobalScope.launch { println("Hello, World!") ...read more

Q23. Can we have an activity without a view?

Ans.

Yes, an activity can exist without a view in Android.

  • An activity can perform background tasks without displaying any UI elements.

  • For example, a music player app may have an activity to handle playback controls in the background.

  • Activities without views are commonly used for tasks like data processing, network operations, or service handling.

Q24. How to send data between two activities?

Ans.

Data can be sent between two activities in Android using Intent with putExtra() method.

  • Create an Intent object in the sending activity

  • Use putExtra() method to add data to the Intent

  • Start the second activity with startActivity() method, passing the Intent

  • Retrieve the data in the receiving activity using getIntent() and getExtra()

Q25. How to update UI in coroutine scope?

Ans.

Use runOnUiThread or withContext(Dispatchers.Main) to update UI in coroutine scope.

  • Use runOnUiThread to update UI from a background thread.

  • Use withContext(Dispatchers.Main) to switch to the main thread in coroutine scope.

  • Example: runOnUiThread { textView.text = "Updated text" }

  • Example: withContext(Dispatchers.Main) { textView.text = "Updated text" }

Q26. Work on android mobile apps and thirdparty services?

Ans.

Yes, I have experience working on android mobile apps and integrating third-party services.

  • Developed and maintained android apps using Java and Kotlin

  • Integrated third-party services like Firebase, Google Maps, and AdMob

  • Implemented RESTful APIs to communicate with server-side

  • Worked with version control tools like Git and SVN

  • Debugged and fixed issues reported by users

Q27. How to play music in background?

Ans.

To play music in background on Android, use a Service class to handle playback and manage audio focus.

  • Create a Service class to handle music playback in the background.

  • Request audio focus to ensure your app can play music even when other apps are using audio.

  • Use MediaPlayer or ExoPlayer to play audio files.

  • Handle media controls and notifications to allow users to control playback from the notification shade.

Q28. How to implement the service in Android?

Ans.

To implement a service in Android, you need to create a class that extends Service and override its lifecycle methods.

  • Create a class that extends Service

  • Override lifecycle methods such as onStartCommand() and onDestroy()

  • Register the service in the AndroidManifest.xml file

  • Start the service using startService() method

Q29. Have you worked on logistics app?

Ans.

Yes, I have worked on a logistics application for a transportation company.

  • Developed real-time tracking feature for monitoring delivery vehicles

  • Implemented route optimization algorithm to improve efficiency

  • Integrated payment gateway for online transactions

  • Designed user-friendly interface for customers and drivers

Q30. Difference between hashcode, equals() and ==.

Ans.

Hashcode is a unique identifier for an object, equals() compares the content of two objects, and == checks if two references point to the same object.

  • Hashcode is an integer value generated by a hashing algorithm to uniquely identify an object.

  • equals() method is used to compare the content of two objects for equality.

  • == operator checks if two references point to the same object in memory.

  • Example: String class overrides equals() method to compare the content of two strings, whi...read more

Q31. What is Hot and Cold Flow?

Ans.

Hot and Cold Flow is a design pattern used in Android development to manage the flow of data between components.

  • Hot Flow refers to the flow of data that is actively being observed and updated in real-time.

  • Cold Flow refers to the flow of data that is not actively being observed and updated, but can be retrieved when needed.

  • Hot Flow is typically used for real-time updates, while Cold Flow is used for fetching data on demand.

Q32. How HashMap Work, LinkedHashMap Different

Ans.

HashMap is an unordered collection of key-value pairs, while LinkedHashMap maintains the insertion order of elements.

  • HashMap uses hashing technique to store and retrieve elements based on their keys.

  • LinkedHashMap extends HashMap and adds a doubly-linked list to maintain the insertion order.

  • HashMap allows null values and only one null key, while LinkedHashMap allows null values and null keys.

  • Example: HashMap map = new HashMap<>();

  • Example: LinkedHashMap linkedMap = new LinkedHa...read more

Q33. Difference between light weight and heavy weight operations

Ans.

Light weight operations are simple and quick, heavy weight operations are complex and time-consuming.

  • Light weight operations are typically simple and quick to execute.

  • Heavy weight operations are usually complex and time-consuming.

  • Examples of light weight operations include basic arithmetic calculations.

  • Examples of heavy weight operations include complex algorithms or database queries.

Q34. How implement the recycler view?

Ans.

The RecyclerView is a flexible view for providing a limited window into a large data set.

  • Create a RecyclerView in your layout XML file.

  • Define a custom adapter class that extends RecyclerView.Adapter.

  • Implement the necessary methods in the adapter class like onCreateViewHolder, onBindViewHolder, and getItemCount.

  • Set the adapter to the RecyclerView in your activity or fragment.

  • Optionally, you can also implement a layout manager to control the arrangement of items in the Recycler...read more

Q35. Difference between Activity and Fragment.

Ans.

Activity is a single focused thing that user can do, while Fragment is a modular section of an activity.

  • Activity represents a single screen with a user interface, while Fragment represents a behavior or a portion of user interface in an Activity.

  • An Activity can contain multiple Fragments, but a Fragment cannot exist independently without an Activity.

  • Fragments have their own lifecycle, while they are dependent on the lifecycle of the Activity they are attached to.

  • Fragments are...read more

Q36. How can we do pagination?

Ans.

Pagination in Android can be achieved by using libraries like Paging Library or implementing custom pagination logic.

  • Use Paging Library provided by Android Architecture Components

  • Implement custom pagination logic by loading data in chunks

  • Update RecyclerView adapter with new data as user scrolls

Q37. How to launch coroutines?

Ans.

Coroutines in Android can be launched using the 'launch' function from the CoroutineScope.

  • Use the 'launch' function from the CoroutineScope to start a coroutine.

  • Specify the context in which the coroutine should run, such as Dispatchers.Main for the main thread.

  • Handle exceptions within the coroutine using try-catch blocks.

  • Example: CoroutineScope(Dispatchers.Main).launch { // coroutine code here }

Q38. What is a broadcast receiver?

Ans.

A broadcast receiver is an Android component that allows the system to deliver events or messages to the app.

  • Broadcast receivers can be used to listen for system-wide broadcast announcements, such as when the device is booted or when the battery is low.

  • They can also be used to receive custom broadcast messages sent by other apps or components within the same app.

  • Broadcast receivers are registered in the AndroidManifest.xml file or dynamically in code using the registerReceive...read more

Q39. What is sealed classes?

Ans.

Sealed classes are used to restrict inheritance in Kotlin, allowing a class to have a fixed set of subclasses.

  • Sealed classes are declared using the 'sealed' keyword.

  • They can only be extended within the same file where they are declared.

  • Sealed classes are often used in conjunction with when expressions for exhaustive checking.

Q40. What is the suspend function?

Ans.

A suspend function is a function that can be paused and resumed at a later time without blocking the main thread.

  • Suspend functions are used in Kotlin coroutines to perform asynchronous operations.

  • They are defined using the 'suspend' keyword in the function signature.

  • Suspend functions can only be called from within another suspend function or a coroutine builder like 'launch' or 'async'.

Q41. Find the second largest number in a given array.

Ans.

Find the second largest number in a given array.

  • Sort the array in descending order

  • Return the element at index 1, which is the second largest number

Q42. Explain some layouts you have worked on.

Ans.

I have worked on various layouts including linear, relative, grid, and constraint layouts.

  • Implemented linear layouts to arrange views in a single column or row.

  • Utilized relative layouts to position views relative to each other.

  • Used grid layouts for displaying data in a grid-like structure.

  • Implemented constraint layouts for creating complex and flexible UI designs.

Q43. Fragment add vs replace lifecycle methods

Ans.

Fragment add vs replace lifecycle methods

  • When using add, the fragment's lifecycle methods are called but the view is not recreated

  • When using replace, the fragment's view is recreated and its lifecycle methods are called

  • Add is useful for retaining the fragment's state, while replace is useful for completely replacing the fragment

Q44. services in android mvvm mvp ROOM DATABASE

Ans.

Services in Android are components that run in the background to perform long-running operations.

  • Services in Android are used to perform tasks in the background without a user interface.

  • MVVM (Model-View-ViewModel) is an architectural pattern that separates the UI from the business logic and data.

  • MVP (Model-View-Presenter) is another architectural pattern that separates the UI from the business logic and data.

  • Room Database is a persistence library that provides an abstraction ...read more

Q45. What is Job scheduler?

Ans.

Job scheduler is a component in Android that allows you to schedule tasks to be run at specified times or intervals.

  • Job scheduler is used to schedule background tasks that need to be run periodically or under certain conditions.

  • It helps in optimizing battery life by grouping tasks and running them when the device is idle.

  • You can set constraints like network availability, charging status, and device idle state for the scheduled tasks.

  • Job scheduler is more efficient than using ...read more

Q46. Why we are using service?

Ans.

Services are used in Android to perform long-running operations in the background without affecting the user interface.

  • Services help in running tasks in the background even when the app is not in the foreground.

  • They can be used for tasks like playing music, downloading files, or fetching data from a server.

  • Services can be started or bound to activities based on the requirements of the app.

Q47. explain oops concept and it's pillars

Ans.

OOPs stands for Object-Oriented Programming. It is based on four main pillars: Inheritance, Encapsulation, Abstraction, and Polymorphism.

  • Inheritance: Allows a class to inherit properties and behavior from another class. Example: class B extends class A.

  • Encapsulation: Bundling data and methods that operate on the data into a single unit. Example: using private access modifiers to restrict access to certain data.

  • Abstraction: Hiding the complex implementation details and showing...read more

Q48. What is back stack?

Ans.

Back stack is a stack of activities in Android that keeps track of the navigation history.

  • Back stack is managed by the Android system to handle the navigation flow of activities.

  • When a new activity is started, it is pushed onto the back stack.

  • Pressing the back button pops the top activity off the stack and navigates to the previous activity.

  • Activities in the back stack can be brought to the foreground by using the appropriate navigation methods.

Q49. What is databinding?

Ans.

Databinding is a feature that allows you to bind UI components in your layout to data sources in your app.

  • Databinding eliminates the need for boilerplate code to update UI components with data.

  • It allows for easier communication between UI components and data sources.

  • Databinding can improve code readability and maintainability.

  • Example: Binding a TextView directly to a ViewModel property in an Android app.

Q50. Explain the opps concept in brief

Ans.

OOPs (Object-Oriented Programming) is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.

  • OOPs focuses on creating objects that interact with each other to solve a problem.

  • It involves concepts like inheritance, encapsulation, polymorphism, and abstraction.

  • Inheritance allows a class to inherit properties and behavior from another class.

  • Encapsulation involves bundling data and methods that opera...read more

1
2
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.4k Interviews
3.8
 • 8.2k Interviews
3.6
 • 7.6k Interviews
3.7
 • 5.6k Interviews
3.8
 • 5.6k Interviews
3.7
 • 4.8k Interviews
4.0
 • 2.4k Interviews
3.3
 • 771 Interviews
3.8
 • 535 Interviews
4.0
 • 261 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Android Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter