Career Development

Android Interview Questions and Answers (Complete Guide) - Part-2

A
By Career Expert
June 23, 2026 5 min read
Android Interview Questions and Answers (Complete Guide) - Part-2

Section 12: Senior Android Questions

55. Explain Modularization.

Benefits:

  • Faster builds
  • Reusability
  • Independent teams

Example:

app
core
network
feature-home
feature-profile

56. How do you reduce APK size?

Answer:

  • R8
  • Proguard
  • App Bundles
  • Image compression
  • Remove unused resources

 

57. How do you optimize app performance?

  • Lazy loading
  • Paging
  • Memory optimization
  • Avoid memory leaks
  • Baseline profiles

 

58. Explain Memory Leak.

Example:

object Singleton {
   var activity: Activity? = null
}

Activity never released.

 

59. How to detect memory leaks?

Tools:

  • LeakCanary
  • Android Profiler

 

60. Difference between ANR and Crash

ANRCrash
App frozenApp terminated
Main thread blockedException

 

Section 13: Android System Design (Lead/Architect)

61. Design WhatsApp Chat Module

Discuss:

  • Offline first
  • Room cache
  • Paging
  • WebSocket
  • Push notifications

 

62. Design YouTube Feed

Topics:

  • Pagination
  • Caching
  • Video preloading
  • Analytics

 

63. Design Uber Driver Tracking

Topics:

  • Real-time location
  • Maps
  • Background service
  • Battery optimization

 

64. How would you architect a large-scale Android application?

Answer:

Presentation
   ↓
Domain
   ↓
Data

Use:

  • Clean Architecture
  • MVVM
  • Hilt
  • Coroutines
  • Modularization

 

65. Explain Clean Architecture

UI Layer
  ↓
Domain Layer
  ↓
Data Layer

Benefits:

  • Scalability
  • Maintainability
  • Testability

 

Advanced Android Interview Questions & Answers

66. What is the difference between Serializable and Parcelable?

  • Serializable

class User(
   val id: Int,
   val name: String
) : Serializable

Advantages

  • Easy to implement
  • Java standard

Disadvantages

  • Slow
  • Uses Reflection
  • More memory consumption

 

  • Parcelable

@Parcelize
data class User(
   val id: Int,
   val name: String
) : Parcelable

Advantages

  • Faster
  • Android optimized
  • Better performance

Disadvantages

  • More code without Parcelize

 

67. What is IPC in Android?

IPC stands for Inter Process Communication.

Used when:

  • One app communicates with another
  • Bound services
  • AIDL implementation

Example:

App A
 ↕
Binder
 ↕
App B

68. What is AIDL?

Android Interface Definition Language.

Used for communication between different processes.

Example:

interface IUserService {
   String getUserName();
}

Used in:

  • Banking apps
  • Enterprise apps
  • Background services

 

69. What is Binder?

Binder is Android's IPC mechanism.

Flow:

Client
  ↓
Binder
  ↓
Service

Most Android framework services use Binder internally.

 

70. What happens when screen rotation occurs?

Before ViewModel:

Activity Destroyed

Activity Recreated

Lifecycle:

onPause()
onStop()
onDestroy()

onCreate()
onStart()
onResume()

71. How does ViewModel survive configuration changes?

ViewModel is stored inside:

ViewModelStore

When Activity recreates:

Old Activity Destroyed

ViewModel Retained

New Activity Attached

Example:

class UserViewModel : ViewModel()

 

72. What is SavedStateHandle?

Used to restore state after process death.

Example:

class UserViewModel(
   private val state: SavedStateHandle
) : ViewModel()

Save:

state["userId"] = 10

Retrieve:

val userId = state["userId"]

 

73. What is Process Death?

Occurs when Android kills app process.

Reasons:

  • Low memory
  • Background restrictions
  • System resource optimization

 

74. Configuration Change vs Process Death

Configuration ChangeProcess Death
RotationApp process killed
ViewModel survivesViewModel lost
Faster recoveryFull restoration needed

 

75. What is WorkManager?

Recommended API for deferrable background work.

Example:

class SyncWorker(
   context: Context,
   params: WorkerParameters
) : Worker(context, params) {

   override fun doWork(): Result {
       return Result.success()
   }
}

76. Why WorkManager instead of Service?

WorkManagerService
Guaranteed executionNot guaranteed
Battery optimizedLess optimized
Handles rebootManual implementation

 

77. Types of WorkManager Requests

One Time

OneTimeWorkRequestBuilder<SyncWorker>()

Periodic

PeriodicWorkRequestBuilder<SyncWorker>()

 

78. Explain Dependency Injection.

Without DI:

class UserRepository {
   private val api = ApiService()
}

Tightly coupled.

With DI:

class UserRepository(
   private val api: ApiService
)

Benefits:

  • Testability
  • Scalability
  • Loose coupling

 

79. What is Constructor Injection?

class UserRepository @Inject constructor(
   private val api: ApiService
)

Recommended by Hilt.

 

80. What is Field Injection?

@Inject
lateinit var repository: UserRepository

Single instance across application.

 

82. What is Scoped Dependency?

Example:

@ActivityRetainedScoped
class UserRepository

Instance exists only for specific scope.

 

83. Explain SOLID Principles.

S - Single Responsibility

One class should have one responsibility.

Bad:

class UserManager {
   fun saveUser(){}
   fun sendEmail(){}
}

Good:

class UserRepository
class EmailService

O - Open Closed Principle

Open for extension.

Closed for modification.

L - Liskov Substitution

Child class should replace parent safely.

I - Interface Segregation

Small interfaces are better.

Bad:

interface Worker {
   fun code()
   fun cook()
}

D - Dependency Inversion

Depend on abstraction.

interface Api

Not concrete implementation.

 

84. Explain Clean Architecture.

Layers:

Presentation
   ↓
Domain
   ↓
Data

Presentation Layer

Contains:

  • Activity
  • Fragment
  • Compose UI
  • ViewModel

Domain Layer

Contains:

  • UseCases
  • Business logic

Example:

class GetUsersUseCase

Data Layer

Contains:

  • Repository
  • API
  • Room

85. Repository Pattern

Repository acts as Single Source of Truth.

Example:

class UserRepository(
   private val api: ApiService,
   private val dao: UserDao
)

Flow:

ViewModel

Repository

API / DB

86. What is Single Source of Truth?

Only one component owns data.

Example:

Repository

instead of

Activity
Fragment
Repository

maintaining separate copies.

 

87. What is Offline First Architecture?

Flow:

UI

Room

Sync

API

Benefits:

  • Works without internet
  • Faster UI
  • Better UX

88. What is Paging 3?

Used for large datasets.

Example:

Pager(
   config = PagingConfig(
       pageSize = 20
   )
)

Benefits:

  • Memory efficient
  • Smooth scrolling

 

89. What is RemoteMediator?

Connects:

Network

Room

for Paging 3.

Example:

class UserRemoteMediator

90. Explain StateFlow.

private val _state =
   MutableStateFlow(UiState())

Observe:

state.collect {}

Characteristics:

  • Hot stream
  • Always has value
  • State holder

 

91. Explain SharedFlow.

MutableSharedFlow<Event>()

Used for:

  • Navigation
  • Snackbar
  • One-time events

92. Why not use StateFlow for Events?

Problem:

Rotation

State replayed

Duplicate event

SharedFlow solves this.

 

93. What is Cold Flow?

Starts producing values when collected.

Example:

flow {
   emit(1)
}

94. What is Hot Flow?

Produces values regardless of collectors.

Examples:

StateFlow
SharedFlow

95. What is Backpressure?

When producer emits faster than consumer processes.

Solution:

buffer()
conflate()
collectLatest()

96. Difference Between collect and collectLatest

collect

Processes all emissions.

flow.collect {}

collectLatest

Cancels previous emission processing.

flow.collectLatest {}

Useful in search functionality.

 

97. Explain Mutex in Coroutines

Used to avoid race conditions.

Example:

val mutex = Mutex()

mutex.withLock {
   count++
}

 

98. What is SupervisorJob?

Failure of one child won't cancel others.

SupervisorJob()

 

99. Explain ANR.

ANR = Application Not Responding

Occurs when:

Main Thread Blocked > 5 seconds

Example:

Thread.sleep(10000)

Never perform network/database work on main thread.

 

100. How to Prevent ANR?

Use:

Dispatchers.IO
WorkManager
Background Threads
Coroutines

Avoid:

Heavy loops
Large DB queries
Network calls on UI thread

101. What is Choreographer?

Android component responsible for frame scheduling.

Target:

60 FPS

Frame budget:

16.67 ms

If exceeded:

Dropped Frames

Jank

102. What is Jank?

UI stuttering caused by:

  • Heavy recomposition
  • Main thread blocking
  • Large layouts
  • Excessive allocations

 

103. How do you improve app startup time?

Techniques:

  • App Startup library
  • Lazy initialization
  • Baseline Profiles
  • Reduce dependency initialization
  • SplashScreen API

 

104. What are Baseline Profiles?

Precompile critical code paths.

Benefits:

  • Faster startup
  • Faster navigation
  • Better scrolling performance

 

105. How do you secure API keys?

Never:

const val API_KEY = "123456"

Use:

  • Remote configuration
  • Encrypted storage
  • Backend token generation

 

106. What is Proguard/R8?

Used for:

  • Code shrinking
  • Obfuscation
  • Optimization

Example:

minifyEnabled true

 

107. How do you secure local data?

Use:

EncryptedSharedPreferences

or

EncryptedFile

 

108. What is Android Keystore?

Stores encryption keys securely.

Example:

KeyGenParameterSpec.Builder(...)

 

109. Explain Certificate Pinning.

Prevents MITM attacks.

Implemented using:

OkHttp CertificatePinner

Link copied to clipboard!