Android Interview Questions & Answers
Android Interview Questions & Answers
id
Crack the Android Interview: 100+
ro
nd
Expert-Level Questions with Solutions
-a
nu
ha
1. What is an Activity in Android?
ris
An Activity is a core Android component that provides a screen for user interaction. It
/k
manages the UI and handles user input.
/in
m
Android manages Activity states through a lifecycle that ensures efficient memory and
n.
Follow: [Link]
Use Cases
/
id
● Hosting a screen such as Login, Dashboard, Settings
ro
nd
● Managing navigation between app screens
-a
● Holding the lifecycle owner for Fragments
nu
ha
Example Implementation
ris
class MainActivity : AppCompatActivity() {
/k
override fun onCreate(savedInstanceState: Bundle?) {
/in
[Link](savedInstanceState)
m
setContentView([Link].activity_main)
co
}
}
n.
di
ke
lin
2. Implicit Intent → Delegate actions to other apps (e.g., open browser)
Example – Explicit
Follow: [Link]
startActivity(Intent(this, DetailsActivity::[Link]))
/
id
ro
Example – Implicit
nd
val intent = Intent(Intent.ACTION_VIEW,
-a
[Link]("[Link]
nu
startActivity(intent)
ha
ris
Use Cases
● Start Activities
/k
/in
m
A Fragment is a reusable portion of UI and logic that must be hosted inside an Activity.
//w
How to Implement
tp
ht
Fragment Transaction
[Link]()
.replace([Link], HomeFragment())
.commit()
Follow: [Link]
/
id
Use Cases
ro
nd
● Reusable UI sections (e.g., Dashboard widget)
-a
● Multi-pane UI for tablets
nu
ha
● Navigation Component destinations
ris
● Bottom navigation and tab layouts
/k
/in
m
co
Types
lin
w.
Follow: [Link]
Use Cases
/
id
● Playing music
ro
nd
● Downloading/uploading files
-a
● Tracking location in the background
nu
ha
ris
/k
5. What is a BroadcastReceiver?
/in
m
Example Implementation
n.
if ([Link] == Intent.ACTION_BATTERY_LOW) { }
lin
}
w.
}
w
//w
Use Cases
s:
tp
Follow: [Link]
6. What is ViewModel and why is it used?
/
id
ro
A ViewModel stores and manages UI-related data in a lifecycle-aware way.
nd
It survives configuration changes like screen rotation.
-a
How It Works
nu
● ViewModel persists until the Activity/Fragment is finished
ha
● Reduces responsibility of Activity/Fragment
ris
/k
● Works well with LiveData/StateFlow
/in
m
Example
co
}
ke
lin
Use Cases
w.
w
● Store UI state
//w
Follow: [Link]
7. What is LiveData?
/
id
ro
LiveData is an observable, lifecycle-aware data holder.
nd
Key Behaviors
-a
nu
● Automatically stops observing when lifecycle is inactive
ha
● Always updates UI on main thread
ris
Example /k
/in
val users = MutableLiveData<List<User>>()
m
co
Use Cases
n.
di
Benefits
Follow: [Link]
● Built-in support for LiveData/Flow
/
id
● Easier migrations
ro
nd
-a
Components
nu
● Entity → Table
ha
● DAO → Data access
ris
/k
● Database → Instance holder
/in
m
Example
co
@Dao
n.
interface UserDao {
di
}
w.
w
Use Cases
//w
● Offline caching
s:
tp
● Persistent storage
ht
Follow: [Link]
9. What is Retrofit?
/
id
ro
Retrofit is a type-safe HTTP client used for networking in Android.
nd
How It Works
-a
nu
● Converts JSON responses using converters (Gson/Moshi)
ha
● Supports Coroutines, RxJava, and suspend functions
ris
Example API Interface /k
/in
interface ApiService {
m
@GET("users")
co
Use Cases
lin
● Authentication
//w
● Upload/download files
s:
tp
ht
Follow: [Link]
Components
/
id
● Model → Data, Repository, Room
ro
nd
● View → Activities/Fragments
-a
● ViewModel → Holds UI logic + LiveData/Flow
nu
ha
Flow
ris
User Action → View → ViewModel → Repository → Data Source →
ViewModel → View /k
/in
m
Use Cases
co
n.
Follow: [Link]
● Fewer resources than Java threads
/
id
● Built-in cancellation
ro
nd
● Cleaner async code (no callbacks)
-a
● Works with suspend functions
nu
ha
How It Works
ris
/k
Coroutines don't block threads; they suspend execution until results are ready.
/in
They rely on Dispatchers:
m
● Main (UI)
co
● IO (network/database)
n.
di
Example Implementation
w
[Link]([Link]) {
//w
updateUI(response)
tp
}
ht
Use Cases
Follow: [Link]
● Network calls
/
id
● Database operations
ro
nd
● Background file processing
-a
● Periodic background tasks
nu
ha
ris
/k
12. What is Kotlin Flow? How is it different from
/in
LiveData?
m
co
Coroutine-based Yes No
tp
ht
How It Works
Example
Follow: [Link]
val userFlow = flow {
/
id
emit([Link]())
ro
}
nd
-a
Use Cases
nu
● Observing database changes (Room Flow)
ha
ris
● Network polling
/k
● Transforming continuous data streams
/in
m
co
n.
Repository is a design pattern that abstracts data sources and provides a clean API for
lin
How It Works
w
//w
● Remote API
ht
● Cache
● Local database
Example
Follow: [Link]
class UserRepository(
/
id
private val api: ApiService,
ro
private val dao: UserDao
nd
) {
suspend fun getUsers() = [Link]()
-a
}
nu
ha
Use Cases
ris
● Separate UI from data logic
/k
/in
● Centralized data management
m
co
Dependency Injection is the process of supplying objects with the dependencies they
//w
Why DI Matters
tp
● Reduces coupling
ht
Follow: [Link]
Hilt
/
id
Hilt is a DI framework for Android built on Dagger, providing:
ro
nd
● Automatic component creation
-a
● Activity/Fragment scoped injections
nu
● ViewModel injection
ha
ris
Example /k
/in
@HiltViewModel
class UserViewModel @Inject constructor(
m
) : ViewModel()
n.
di
ke
Use Cases
lin
● Inject ViewModels
w.
Follow: [Link]
How It Works
/
id
When enabled, Android generates a binding class for each XML layout.
ro
nd
Implementation
-a
private lateinit var binding: ActivityMainBinding
nu
override fun onCreate(savedInstanceState: Bundle?) {
ha
[Link](savedInstanceState)
ris
binding = [Link](layoutInflater)
/k
setContentView([Link])
/in
}
m
co
Use Cases
n.
● Prevents NullPointerException
di
ke
● Safer UI development
w.
w
//w
s:
from ViewBinding?
DataBinding allows you to bind UI components directly to data sources using XML.
Difference
Follow: [Link]
Feature ViewBinding DataBinding
/
❌ No
id
XML binding ✔ Yes
ro
expressions
nd
Two-way binding ❌ No ✔ Yes
-a
nu
Performance Faster Slower
ha
Use cases Simple UI Dynamic, reactive UI
ris
Example
/k
<TextView android:text="@{[Link]}" />
/in
m
co
Use Cases
n.
● MVVM architecture
di
ke
● Reducing UI boilerplate
lin
over Serializable?
Parcelable is an Android-optimized interface for serializing objects so they can be
passed between components (e.g., via Intent).
Why Preferred
Follow: [Link]
● Faster
/
id
● Less memory overhead
ro
nd
● Designed for Android IPC
-a
nu
Example
ha
@Parcelize
ris
data class User(val id: Int, val name: String) : Parcelable
/k
/in
Use Cases
m
than ListView?
//w
s:
RecyclerView is an advanced, more flexible version of ListView, optimized for large and
tp
dynamic lists.
ht
Why Better
Follow: [Link]
● Supports multiple LayoutManagers
/
id
● More efficient recycling mechanism
ro
nd
-a
Example
nu
[Link] = UserAdapter()
[Link] = LinearLayoutManager(this)
ha
ris
Use Cases
/k
/in
● Chat lists
m
● Product listing
co
n.
calls.
tp
Why It Matters
ht
Follow: [Link]
Example
/
id
class UserViewHolder(val binding: ItemUserBinding) :
ro
[Link]([Link])
nd
-a
Use Cases
nu
● All RecyclerView adapters
ha
ris
● Efficient list rendering
/k
/in
m
co
DiffUtil is a utility class that calculates differences between two lists and updates only
the changed items.
ke
lin
How It Works
w.
● Animates changes
tp
ht
● Improves performance
Example
class UserDiff : [Link]<User>() {
Follow: [Link]
override fun areItemsTheSame(old: User, new: User) = [Link]
/
id
== [Link]
ro
override fun areContentsTheSame(old: User, new: User) = old
nd
== new
}
-a
nu
ha
Use Cases
ris
● Large lists
● Real-time feeds
co
n.
di
ke
Why Important
s:
Example
Follow: [Link]
class UploadWorker(appContext: Context, params:
/
id
WorkerParameters) : Worker(appContext, params) {
ro
override fun doWork(): Result {
nd
return [Link]()
}
-a
}
nu
ha
Use Cases
ris
● Syncing data /k
/in
● Uploading logs
m
co
Features
s:
● Interceptors
tp
ht
● Connection pooling
● Caching
● HTTP/2 support
Follow: [Link]
Example
/
id
val client = [Link]()
ro
.addInterceptor(loggingInterceptor)
nd
.build()
-a
nu
Use Cases
ha
● Adding authentication headers
ris
● Logging network calls
/k
/in
● Custom retry logic
m
co
n.
di
Why Needed
w
//w
Example
tp
: [Link] {
override fun <T : ViewModel> create(modelClass: Class<T>): T
{
return UserViewModel(repo) as T
}
Follow: [Link]
}
/
id
ro
Use Cases
nd
-a
● MVVM with parameters
nu
● Testing ViewModels
ha
● Integrating repositories/services
ris
/k
/in
m
ProGuard/R8 are code optimization tools used during build to shrink, obfuscate, and
di
optimize code.
ke
How It Works
lin
w.
● Renames classes/methods
s:
● Optimizes bytecode
tp
ht
Use Cases
● Improve performance
Follow: [Link]
● Protect source code from reverse engineering
/
id
ro
nd
-a
25. What is Android Jetpack Navigation
nu
Component?
ha
ris
Navigation Component is Android’s framework for managing in-app navigation using a
graph-based approach.
/k
/in
Key Features
m
Example
//w
findNavController().navigate([Link].action_home_to_detail)
s:
tp
ht
Use Cases
● Single-Activity architecture
Follow: [Link]
/
id
ro
nd
26. What is the Android Application Class?
-a
The Application class is the first component created when an Android app process
nu
starts. It maintains global app state.
ha
How It Works
ris
/k
● Initialized before any Activity or Service
/in
● Lives as long as the app’s process remains in memory
m
co
Implementation
ke
[Link]()
w
}
}
s:
tp
ht
Use Cases
● Global configuration
Follow: [Link]
● Caching application-wide values
/
id
ro
nd
-a
27. What is a ContentProvider?
nu
ha
ContentProvider manages access to a structured set of data. It allows sharing data
between apps securely.
ris
How It Works /k
/in
● Uses URIs to identify data
m
co
Example
lin
}
//w
s:
Use Cases
tp
ht
● Contacts provider
Follow: [Link]
/
id
ro
28. What are PendingIntents and why are they
nd
important?
-a
nu
A PendingIntent grants another app (e.g., NotificationManager) the permission to
execute an action on behalf of your app.
ha
ris
How It Works
● Holds an Intent
/k
/in
m
Example
val pendingIntent = [Link](
lin
PendingIntent.FLAG_IMMUTABLE
w
)
//w
s:
Use Cases
tp
ht
● Notification clicks
● AlarmManager triggers
Follow: [Link]
/
id
ro
29. What is Android Handler and Looper?
nd
-a
● Looper runs a message loop on a thread.
nu
● Handler posts tasks (messages/runnables) to a looper queue.
ha
ris
How It Works
/k
● UI thread has a default Looper
/in
m
Example
di
Handler([Link]()).post {
ke
[Link] = "Updated"
lin
}
w.
w
Use Cases
//w
Follow: [Link]
30. What is ANR (Application Not Responding)?
/
id
ro
ANR occurs when the main thread is blocked for too long:
nd
● 5 seconds for input events
-a
nu
● 10 seconds for broadcast handling
ha
Causes
ris
/k
● Heavy work on main thread
/in
● Database operations on main thread
m
co
● Infinite loops
di
ke
lin
Prevention
w.
● Profile performance
tp
ht
Follow: [Link]
Service
/
id
Runs on main thread—developer must manage threading.
ro
nd
IntentService
-a
● Handles background work on a worker thread
nu
● Automatically stops after task completes
ha
(Deprecated in API 30)
ris
JobIntentService
/k
/in
m
Use Cases
lin
ce execution
s:
operations
ht
Follow: [Link]
● Network availability
/
id
● Charging state
ro
nd
● Idle state
-a
nu
Example
ha
val jobInfo = [Link](1, ComponentName(this,
ris
SyncJob::[Link]))
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
/k
.build()
/in
m
co
Use Cases
n.
● Periodic sync
di
ke
● Uploading logs
lin
How It Works
● Persistent storage
Follow: [Link]
● Usually for lightweight configuration
/
id
● Synchronous API (use DataStore for modern approach)
ro
nd
-a
Example
nu
val prefs = getSharedPreferences("settings", MODE_PRIVATE)
[Link]().putBoolean("dark_mode", true).apply()
ha
ris
Use Cases
/k
/in
● App settings
m
● Login/session flags
co
n.
SharedPreferences?
//w
s:
Flow.
ht
Why Better
● No ANRs (non-blocking)
Follow: [Link]
● Handles data consistency
/
id
ro
Use Cases
nd
● Settings/preferences
-a
nu
● User onboarding flags
ha
● Lightweight configuration
ris
/k
/in
m
Types
lin
● Application Interceptors
w.
● Network Interceptors
w
//w
Example
s:
tp
Follow: [Link]
Use Cases
/
id
● Add authentication headers
ro
nd
● Logging
-a
● Caching control
nu
ha
ris
/k
36. What is a Sealed Class in Kotlin?
/in
m
Why Important
n.
di
Example
s:
Follow: [Link]
37. What is the difference between val and var in
/
id
Kotlin?
ro
nd
Keyword Description
-a
val Immutable reference
nu
(read-only)
ha
var Mutable reference
ris
Use Cases /k
/in
● Use val for most variables (cleaner, safer code)
m
co
Jetpack Compose is a modern UI toolkit that uses a declarative programming model for
building Android UIs.
//w
s:
How It Works
tp
Example
@Composable
Follow: [Link]
fun Greeting(name: String) {
/
id
Text("Hello $name")
ro
}
nd
-a
Use Cases
nu
● Faster UI development
ha
ris
● Dynamic UI rendering
● Reactive apps /k
/in
m
co
n.
Compose UI?
lin
XML
w.
w
● Imperative
//w
● View hierarchy
s:
tp
Compose
● Declarative
Follow: [Link]
● Composable functions
/
id
● Automatic state-based UI updates
ro
nd
-a
Use Cases
nu
● XML → legacy, complex custom views
ha
● Compose → modern apps, rapid development
ris
/k
/in
m
Why Important
lin
● Makes UI stateless
w.
Example
ht
@Composable
fun Counter(count: Int, onIncrement: () -> Unit) {
Button(onClick = onIncrement) { Text("$count") }
}
Follow: [Link]
/
id
ro
41. Explain Android Clean Architecture.
nd
-a
Clean Architecture separates code into independent layers:
nu
● Presentation (UI)
ha
● Domain (Use cases)
ris
/k
● Data (Repository & sources)
/in
m
How It Works
co
Use Cases
w.
● Enterprise apps
w
//w
● Large codebases
s:
tp
● Testable apps
ht
Follow: [Link]
ADB is a command-line tool used for communication with Android devices/emulators.
/
id
Examples
ro
nd
● adb install [Link]
-a
● adb logcat (view logs)
nu
ha
● adb shell (device commands)
ris
Use Cases /k
/in
● Testing and debugging
m
co
● Installing/uninstalling apps
ke
lin
w.
w
Manifest file defines essential information about the app for the Android system.
s:
tp
Contains
ht
● Permissions
● App metadata
Follow: [Link]
Use Cases
/
id
● Registering components
ro
nd
● Declaring permissions
-a
● Setting app theme
nu
ha
ris
/k
44. What are Android Permissions?
/in
m
Types
co
Example
w.
<uses-permission android:name="[Link]"/>
w
//w
Use Cases
s:
tp
● Camera access
ht
● Location access
● Storage/File access
Follow: [Link]
45. What is the Android Build Process?
/
id
ro
Stages
nd
1. Source code → Kotlin compiler
-a
nu
2. Dexing → converts to Dalvik bytecode
ha
3. Resource linking
ris
4. Packaging into APK/AAB
/k
/in
5. Signing
m
co
6. Deployment
n.
di
Use Cases
ke
● Build optimization
w
//w
s:
tp
A ProGuard rule configures how R8/ProGuard should shrink, obfuscate, or keep code.
Example
-keep class [Link].** { *; }
Follow: [Link]
Use Cases
/
id
● Preserve model classes
ro
nd
● Prevent library crashes during shrinking
-a
nu
ha
47. What is Multidex in Android?
ris
/k
Android apps are limited to 65,536 methods per DEX file.
/in
Multidex splits code into multiple DEX files.
m
co
Use Cases
n.
● Large apps
di
ke
AAB is a publishing format that contains all app resources, allowing Play Store to
tp
Benefits
Follow: [Link]
● Dynamic features
/
id
● Faster installs
ro
nd
-a
nu
49. What is Crashlytics?
ha
ris
Crashlytics (Firebase) is a crash-reporting tool to track, analyze, and fix app crashes.
Use Cases
/k
/in
m
Lottie is a library for rendering vector animations exported from Adobe After Effects
(JSON files).
tp
ht
Example
[Link]("[Link]")
[Link]()
Follow: [Link]
Use Cases
/
id
● Loading animations
ro
nd
● Onboarding screens
-a
● UI motion effects
nu
ha
ris
/k
51. What is a Retrofit Converter and why do we
/in
use it?
m
co
typed objects.
di
ke
Common Converters
lin
● GsonConverter
w.
● MoshiConverter
w
//w
● ScalarsConverter
s:
How It Works
Retrofit reads the response body → converter transforms JSON → Kotlin data class.
Example
Follow: [Link]
[Link]()
/
id
.baseUrl(BASE_URL)
ro
.addConverterFactory([Link]())
nd
.build()
-a
nu
Use Cases
ha
● JSON parsing
ris
● Sending JSON payloads
/k
/in
● Working with APIs
m
co
n.
di
Gson?
lin
w.
Difference
w
//w
e ent
Follow: [Link]
Use Cases
/
id
● Serialization for Kotlin-first projects
ro
nd
● Safer JSON handling
-a
nu
ha
53. What is the Paging 3 Library?
ris
/k
Paging 3 helps load large datasets gradually, improving memory and performance.
/in
m
How It Works
co
Example
w
//w
Use Cases
ht
Follow: [Link]
/
id
ro
54. What is ViewModelScope?
nd
-a
viewModelScope is a CoroutineScope tied to a ViewModel lifecycle.
nu
How It Works
ha
● Automatically cancels coroutines when ViewModel clears
ris
/k
● Prevents memory leaks
/in
m
Example
co
[Link] {
n.
[Link]()
di
}
ke
lin
Use Cases
w.
● Database operations
s:
tp
● UI state updates
ht
Follow: [Link]
lifecycleScope is a CoroutineScope tied to Activity/Fragment lifecycle.
/
id
ro
How It Works
nd
● Cancels coroutines when lifecycle is destroyed
-a
● Prevents crashes and leaks
nu
ha
Use Cases
ris
● Collecting Flow in a Fragment
/k
/in
● Run background tasks safely
m
co
n.
di
Types
w
//w
● HTTP URLs
s:
Use Cases
Follow: [Link]
● Marketing campaigns
/
id
● Navigating from notifications
ro
nd
● Web → app routing
-a
nu
ha
ris
57. What are Android App Links?
/k
App Links are HTTP URLs verified by the Android system to open the app instead of the
/in
browser.
m
co
Requirements
n.
Use Cases
w
//w
Follow: [Link]
Examples
/
id
● Network available
ro
nd
● Device charging
-a
● Battery not low
nu
ha
Example
ris
val constraint = [Link]()
/k
.setRequiredNetworkType([Link])
/in
.build()
m
co
Use Cases
n.
di
● Sync jobs
ke
● Background uploading
lin
w.
Common Scopes
Follow: [Link]
● @Singleton → App-level
/
id
ro
● @ActivityScoped
nd
● @FragmentScoped
-a
nu
● @ViewModelScoped
ha
ris
Use Cases
/k
/in
● Reusing instances
m
Types
s:
● [Link] → UI
tp
● [Link] → Network/database
ht
● [Link] → CPU-bound
Follow: [Link]
Use Cases
/
id
● Main → UI work
ro
nd
● IO → network/db
-a
● Default → CPU processing
nu
ha
ris
/k
61. What is an Android HandlerThread?
/in
m
How It Works
n.
di
Example
s:
Use Cases
Follow: [Link]
● Offloading heavy tasks from main thread
/
id
ro
nd
-a
62. What is Vector Drawable?
nu
ha
Vector drawable is a scalable graphic defined using XML paths (no bitmap).
ris
Benefits
● Resolution-independent
co
Use Cases
lin
● App icons
w.
Follow: [Link]
ConstraintLayout is a flexible layout allowing complex UI with flat view hierarchy.
/
id
Benefits
ro
nd
● Reduces nested layouts
-a
● Better performance
nu
ha
● Responsive design
ris
Use Cases /k
/in
● Complex screens
m
co
● Responsive forms
n.
How It Works
ht
● Constraints
Follow: [Link]
● Interpolators
/
id
ro
Use Cases
nd
● Interactive animations
-a
nu
● Swipe gestures
ha
● Login transitions
ris
/k
/in
m
Why Important
lin
● Increases FPS
w.
● Improves animations
w
//w
● Reduces UI jank
s:
tp
Use Cases
ht
● Smooth animations
● Heavy UI rendering
Follow: [Link]
/
id
ro
66. What is AppCompat?
nd
-a
AppCompat provides backward-compatible UI components and themes.
nu
Features
ha
● Toolbar
ris
● Material components /k
/in
● Dark mode support
m
co
Use Cases
n.
di
Example
ht
[Link]()
Use Cases
Follow: [Link]
● Skeleton loading screens
/
id
● Improving user experience during API calls
ro
nd
-a
nu
68. What is Coil/Glide/Picasso in Android?
ha
ris
Image loading libraries designed to load images efficiently.
Comparison
/k
/in
m
Library Highlight
co
Coil Kotlin-first,
n.
fastest
di
o
w.
w
Use Cases
//w
● Caching images
ht
Follow: [Link]
69. What are Android Architecture Layers?
/
id
ro
Layers
nd
1. UI Layer
-a
nu
2. Domain Layer
ha
3. Data Layer
ris
Why Important /k
/in
● Separation of concerns
m
co
● Testability
n.
di
● Scalability
ke
lin
w.
w
Example
ht
Follow: [Link]
/
id
Use Cases
ro
nd
● MVVM state management
-a
● Unidirectional data flow
nu
ha
ris
71. What is a Broadcast? /k
/in
m
Examples
n.
di
● Battery low
ke
● Connectivity change
lin
w.
● Boot completed
w
//w
Use Cases
s:
Follow: [Link]
72. What is Coroutine Exception Handling?
/
id
ro
Approaches
nd
● try/catch inside coroutine
-a
nu
● CoroutineExceptionHandler
ha
● supervisorScope
ris
● SupervisorJob /k
/in
m
Example
co
}
ke
lin
w.
Use Cases
w
Follow: [Link]
Example
/
id
[Link](view, "Saved", Snackbar.LENGTH_SHORT).show()
ro
nd
Use Cases
-a
nu
● User feedback
ha
● Undo actions
ris
/k
/in
m
BottomSheetDialog?
n.
di
UX Traditional Modern UI
//w
pattern
s:
Use Cases
tp
ht
Follow: [Link]
75. What is Android Data Binding 2-way binding?
/
id
ro
Two-way binding automatically updates:
nd
● UI when data changes
-a
nu
● Data when UI changes
ha
Example
ris
<EditText
/k
android:text="@={[Link]}" />
/in
m
co
Use Cases
n.
● Forms
di
ke
● Real-time validation
w.
w
//w
s:
StateFlow?
Follow: [Link]
Type Lifecycle-aware Hot Flow stream
/
id
observable
ro
Thread-safet Main-thread only Fully thread-safe
nd
y
-a
Data Only when active Always
nu
emission
ha
Nullability Can be null Requires initial
ris
value
How It Works
/k
/in
m
Use Cases
lin
Common Operators
Follow: [Link]
● map → transform
/
id
ro
● filter → remove elements
nd
● flatMapLatest → switch latest
-a
nu
● combine → merge streams
ha
● debounce → avoid rapid emissions
ris
Example
/k
/in
flowOf(1,2,3)
m
.map { it * 2 }
co
.collect { println(it) }
n.
di
ke
Use Cases
lin
● Search debounce
w.
Follow: [Link]
How It Works
/
id
● Requires startForeground()
ro
nd
● Higher priority, not easily killed
-a
nu
Example
ha
startForeground(1, notification)
ris
Use Cases
/k
/in
m
● GPS tracking
co
● Music playback
n.
di
● Fitness tracking
ke
lin
w.
w
A memory leak occurs when objects that are no longer needed remain in memory.
s:
tp
Common Causes
ht
Follow: [Link]
● Unregistered listeners
/
id
● ViewBinding not cleared in Fragments
ro
nd
-a
Prevention
nu
● Use application context carefully
ha
● Cancel coroutines in onDestroyView()
ris
/k
● Avoid static Activity references
/in
m
co
n.
How It Works
w.
w
Use Cases
Follow: [Link]
● Improving app stability
/
id
ro
nd
-a
81. What is a Repository in Android
nu
Architecture?
ha
ris
Repository abstracts data sources and provides a clean API for ViewModels.
How It Works /k
/in
● Fetches data from Room, network, cache
m
co
● Handles synchronization
n.
di
Example
w.
class UserRepository(
w
}
ht
Use Cases
● MVVM
Follow: [Link]
● Clean Architecture
/
id
● Testability
ro
nd
-a
nu
82. What is Room Database?
ha
ris
Room is a SQLite abstraction providing:
● Type-safety
/k
/in
m
● Coroutines/Flow support
n.
di
ke
Components
lin
● Entity
w.
● DAO
w
//w
● Database
s:
tp
Use Cases
ht
● Local caching
● Offline-first apps
Follow: [Link]
/
id
ro
83. What is an Entity in Room?
nd
-a
Entity represents a database table.
nu
Example
ha
@Entity
ris
data class User(
@PrimaryKey val id: Int,
val name: String
/k
/in
)
m
co
Use Cases
n.
di
Example
@Dao
interface UserDao {
@Query("SELECT * FROM User")
fun getAll(): Flow<List<User>>
Follow: [Link]
}
/
id
ro
Use Cases
nd
-a
● Database access layer
nu
ha
ris
85. What is WorkManager chaining?
/k
/in
Chaining allows running multiple WorkRequests sequentially or in parallel.
m
co
Example
[Link](work1)
n.
.then(work2)
di
.enqueue()
ke
lin
w.
Use Cases
w
Follow: [Link]
● Faster
/
id
● Manual implementation
ro
nd
● Optimized for Android IPC
-a
nu
Serializable
ha
● Slower
ris
● Uses reflection /k
/in
● Simpler but not recommended
m
co
Use Cases
n.
di
DiffUtil calculates list differences efficiently and updates only changed items.
tp
Example
ht
Follow: [Link]
Use Cases
/
id
● Improving RecyclerView performance
ro
nd
● Handling large lists
-a
nu
ha
88. What is a RecyclerView Adapter Delegate?
ris
/k
A design pattern splitting adapter logic by view type.
/in
m
Why Useful
co
● Cleaner code
n.
di
● Reusable delegates
ke
● Easy maintenance
lin
w.
Use Cases
w
//w
Follow: [Link]
● Status bar
/
id
● Navigation bar
ro
nd
● Keyboard
-a
nu
Use Cases
ha
● Fullscreen UI
ris
● Keyboard handling /k
/in
● Edge-to-edge layout
m
co
n.
di
and productFlavors?
w.
buildTypes
w
//w
● Debug vs Release
s:
productFlavors
Follow: [Link]
● Example: free vs paid, staging vs production
/
id
ro
Use Cases
nd
● Multi-environment builds
-a
nu
ha
ris
91. What is StrictMode? /k
/in
StrictMode detects accidental slow or unsafe operations on the main thread.
m
Example
co
[Link](
n.
di
[Link]().detectAll().penaltyLog().build
ke
()
lin
)
w.
w
Use Cases
//w
s:
Follow: [Link]
Secure storage for cryptographic keys.
/
id
Use Cases
ro
nd
● Storing tokens
-a
● Encrypting sensitive data
nu
ha
● Secure authentication
ris
/k
/in
Remote Config allows dynamic feature changes without publishing a new app.
n.
di
Use Cases
ke
● Feature toggles
lin
w.
● Dynamic UI text
w
● A/B testing
//w
s:
tp
ht
Use Cases
Follow: [Link]
● Storing tokens
/
id
● Saving sensitive user data
ro
nd
-a
nu
95. What is a NoSQL database in Android?
ha
ris
Examples
● Firebase Firestore
/k
/in
m
● Realm
co
● Couchbase Lite
n.
di
ke
Use Cases
lin
● Realtime data
w.
w
● Complex sync
//w
● Offline-first applications
s:
tp
ht
Follow: [Link]
dp → density independent
/
id
sp → scalable size (for text)
ro
nd
px → actual pixels
-a
Use Cases
nu
ha
● dp → Layout
ris
● sp → Fonts
/k
/in
● px → Bitmap manipulation
m
co
n.
di
● NavGraph
w
● NavHost
//w
s:
● NavController
tp
ht
Benefits
Follow: [Link]
● Easier deep linking
/
id
ro
nd
-a
98. What is SafeArgs?
nu
ha
SafeArgs generates type-safe classes for passing arguments through navigation.
ris
Example
/k
val action = [Link](userId)
/in
findNavController().navigate(action)
m
co
Use Cases
n.
Benefits
● Faster startup
● Lazy initialization
Follow: [Link]
● Avoiding heavy initialization on main thread
/
id
ro
nd
-a
100. What is Kotlin Inline Function?
nu
ha
Definition
ris
Inline functions copy the function body to the call site instead of creating a new function
call. /k
/in
Benefits
m
co
Example
lin
}
//w
s:
Use Cases
tp
ht
Follow: [Link]