0% found this document useful (0 votes)
34 views80 pages

Android Interview Questions & Answers

The document provides a comprehensive guide on Android development, covering key concepts such as Activity, Intent, Fragment, Service, ViewModel, LiveData, Room Database, Retrofit, MVVM architecture, Kotlin Coroutines, and Dependency Injection with Hilt. Each concept includes definitions, use cases, example implementations, and comparisons where applicable. The content is structured to help prepare for Android interviews with over 100 expert-level questions and solutions.

Uploaded by

Syed Tahaseen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views80 pages

Android Interview Questions & Answers

The document provides a comprehensive guide on Android development, covering key concepts such as Activity, Intent, Fragment, Service, ViewModel, LiveData, Room Database, Retrofit, MVVM architecture, Kotlin Coroutines, and Dependency Injection with Hilt. Each concept includes definitions, use cases, example implementations, and comparisons where applicable. The content is structured to help prepare for Android interviews with over 100 expert-level questions and solutions.

Uploaded by

Syed Tahaseen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

/

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

How It Works / Lifecycle


co

Android manages Activity states through a lifecycle that ensures efficient memory and
n.

UI handling. Key callbacks:


di

●​ onCreate() → Initialize UI, ViewBinding, ViewModel, data loading​


ke
lin

●​ onStart() → Activity becomes visible​


w.

●​ onResume() → UI becomes interactive​


w
//w

●​ onPause() → Temporary interruption (e.g., incoming call)​


s:
tp

●​ onStop() → Not visible​


ht

●​ onDestroy() → Final cleanup​

●​ onRestart() → Activity moves from stopped → started​

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. What is an Intent in Android?


w.
w

An Intent is a messaging object used to request an action from another


//w

component—Activity, Service, or BroadcastReceiver.


s:

Types & How to Use


tp
ht

1.​ Explicit Intent → Navigate within your app​

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

●​ Start background Services​


co

●​ Broadcast system events (battery, Wi-Fi, etc.)​


n.
di
ke
lin

3. What is a Fragment? Why do we use it?


w.
w

A Fragment is a reusable portion of UI and logic that must be hosted inside an Activity.
//w

It supports modular UI and dynamic layouts.


s:

How to Implement
tp
ht

class HomeFragment : Fragment([Link].fragment_home) { }

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

4. What is a Service in Android?


n.
di

A Service is a component used for long-running background tasks without a UI.


ke

Types
lin
w.

1.​ Foreground Service – shows notification, must run actively​


w

2.​ Background Service – runs silently (restricted in modern Android)​


//w
s:

3.​ Bound Service – provides client-server communication​


tp
ht

Example – Foreground Service


startForegroundService(Intent(this, MusicService::[Link]))

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

A BroadcastReceiver listens for system or app events and reacts accordingly.


co

Example Implementation
n.

class BatteryReceiver : BroadcastReceiver() {


di

override fun onReceive(context: Context, intent: Intent) {


ke

if ([Link] == Intent.ACTION_BATTERY_LOW) { }
lin

}
w.

}
w
//w

Use Cases
s:
tp

●​ Monitor network state​


ht

●​ Listen for system broadcasts (boot completed, battery low)​

●​ Receive FCM notifications via broadcast​

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

class UserViewModel : ViewModel() {


n.

val userName = MutableLiveData<String>()


di

}
ke
lin

Use Cases
w.
w

●​ Store UI state​
//w

●​ Manage business logic​


s:
tp

●​ Avoid memory leaks and redundant data reloads​


ht

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

●​ Updating UI when data changes​


ke

●​ Observing ViewModel data from Activity/Fragment​


lin
w.
w
//w

8. What is Room Database?


s:
tp

Room is an ORM that provides a simpler, safer abstraction over SQLite.


ht

Benefits

●​ Compile-time SQL validation​

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

@Query("SELECT * FROM User")


ke

fun getUsers(): List<User>


lin

}
w.
w

Use Cases
//w

●​ Offline caching​
s:
tp

●​ Persistent storage​
ht

●​ Storing structured local data​

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

suspend fun getUsers(): List<User>


}
n.
di
ke

Use Cases
lin

●​ REST API communication​


w.
w

●​ Authentication​
//w

●​ Upload/download files​
s:
tp
ht

10. Explain MVVM Architecture.


MVVM (Model–View–ViewModel) is an architectural pattern that separates UI from
business logic.

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.

●​ Testable, maintainable code​


di
ke

●​ Scalable large Android apps​


lin

●​ Reduces Activity/Fragment complexity


w.
w

11. What is Kotlin Coroutine and why is it


//w

preferred over Threads?


s:
tp

A Coroutine is a lightweight concurrency framework in Kotlin designed for


ht

asynchronous and non-blocking programming. Coroutines run within a


CoroutineScope and allow structured concurrency.

Why Preferred Over Threads

●​ Cheaper to create and manage​

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

●​ Default (CPU-heavy tasks)​


ke
lin
w.

Example Implementation
w

[Link]([Link]) {
//w

val response = [Link]()


withContext([Link]) {
s:

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

Flow is a cold, asynchronous data stream that emits values sequentially.


n.
di

Key Differences (Flow vs LiveData)


ke

Property Flow LiveData


lin

Lifecycle aware No Yes


w.

Supports backpressure Yes No


w
//w

Used for Data streams UI updates


s:

Coroutine-based Yes No
tp
ht

How It Works

Flow emits values when collected.​


Collection happens inside coroutines.

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.

13. What is the Repository Pattern in Android?


di
ke

Repository is a design pattern that abstracts data sources and provides a clean API for
lin

the rest of the app.


w.

How It Works
w
//w

The UI layer never directly calls API or Room.​


Instead, it communicates with a repository which fetches data from:
s:
tp

●​ 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

●​ Switch data sources easily (offline/online)​


n.
di
ke
lin

14. Explain Dependency Injection (DI) and Hilt.


w.
w

Dependency Injection is the process of supplying objects with the dependencies they
//w

need rather than creating them internally.


s:

Why DI Matters
tp

●​ Reduces coupling​
ht

●​ Enables easier testing​

●​ Supports modular code​

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

private val repository: UserRepository


co

) : ViewModel()
n.
di
ke

Use Cases
lin

●​ Inject ViewModels​
w.

●​ Inject repositories + Retrofit + Room​


w
//w

●​ Modular, testable architecture​


s:
tp
ht

15. What is ViewBinding?


ViewBinding provides type-safe, compile-time-verified access to views without
findViewById().

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

●​ Eliminates view boilerplate​


lin

●​ Safer UI development​
w.
w
//w
s:

16. What is DataBinding and how is it different


tp
ht

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

●​ Two-way form inputs​


w.
w
//w
s:

17. What is Parcelable and why is it preferred


tp
ht

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

●​ Passing objects between Activities​


co
n.

●​ Saving state in Bundles​


di
ke
lin
w.

18. What is RecyclerView and why is it better


w

than ListView?
//w
s:

RecyclerView is an advanced, more flexible version of ListView, optimized for large and
tp

dynamic lists.
ht

Why Better

●​ ViewHolder enforced for performance​

●​ Supports animations and diffing​

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.

●​ Social media feeds​


di
ke
lin
w.

19. Explain the ViewHolder pattern.


w
//w

A ViewHolder stores references to item views to avoid repeated findViewById()


s:

calls.
tp

Why It Matters
ht

●​ Improves scrolling performance​

●​ Reduces unnecessary view lookups​

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

20. What is DiffUtil?


n.
di

DiffUtil is a utility class that calculates differences between two lists and updates only
the changed items.
ke
lin

How It Works
w.

Instead of refreshing the entire RecyclerView, DiffUtil:


w
//w

●​ Computes the minimal update set​


s:

●​ 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​

●​ Live data updates​


/k
/in
m

●​ Real-time feeds​
co
n.
di
ke

21. Explain WorkManager.


lin
w.

WorkManager is a background task scheduler for deferrable, guaranteed execution


tasks.
w
//w

Why Important
s:

●​ Works even if the app is closed​


tp
ht

●​ Handles constraints (network, charging)​

●​ Backed by OS-friendly scheduling​

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

●​ Scheduling periodic jobs​


n.
di
ke
lin

22. What is OkHttp?


w.
w

OkHttp is a powerful HTTP client used by Retrofit for network calls.


//w

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

23. What is ViewModelFactory?


ke
lin

ViewModelFactory provides a way to create ViewModels with custom dependencies.


w.

Why Needed
w
//w

Default ViewModelProvider cannot pass constructor arguments.


s:

Example
tp

class UserViewModelFactory(private val repo: UserRepository)


ht

: [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

24. What is ProGuard / R8 in Android?


co
n.

ProGuard/R8 are code optimization tools used during build to shrink, obfuscate, and
di

optimize code.
ke

How It Works
lin
w.

●​ Removes unused classes​


w
//w

●​ Renames classes/methods​
s:

●​ Optimizes bytecode​
tp
ht

Use Cases

●​ Reduce APK size​

●​ 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

●​ Handles Fragment transactions automatically​


co
n.

●​ Type-safe arguments via SafeArgs​


di
ke

●​ Supports deep links and global actions​


lin

●​ Works well with MVVM and Single-Activity apps​


w.
w

Example
//w

findNavController().navigate([Link].action_home_to_detail)
s:
tp
ht

Use Cases

●​ Single-Activity architecture​

●​ Complex in-app navigation​

●​ Handling back stack automatically

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

●​ Useful for initializing libraries, DI, analytics, logging, etc.​


n.
di

Implementation
ke

class MyApp : Application() {


lin

override fun onCreate() {


w.

[Link]()
w

// Initialize Hilt, Timber, Firebase, etc.


//w

}
}
s:
tp
ht

Use Cases

●​ Global configuration​

●​ Dependency injection initialization​

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

●​ Exposes CRUD operations​


n.

●​ Works with Cursor, LiveData, or Paging​


di
ke

Example
lin

class UserProvider : ContentProvider() {


w.

override fun query(...): Cursor? { ... }


w

}
//w
s:

Use Cases
tp
ht

●​ Sharing data across applications​

●​ MediaStore (images, videos)​

●​ 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

●​ Executes Intent later with app’s permission​


co

●​ Common in Notifications, Alarms, Widgets​


n.
di
ke

Example
val pendingIntent = [Link](
lin

this, 0, Intent(this, MainActivity::[Link]),


w.

PendingIntent.FLAG_IMMUTABLE
w

)
//w
s:

Use Cases
tp
ht

●​ Notification clicks​

●​ AlarmManager triggers​

●​ App widgets actions​

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

●​ Handlers allow background threads to communicate with main thread​


co
n.

Example
di

Handler([Link]()).post {
ke

[Link] = "Updated"
lin

}
w.
w

Use Cases
//w

●​ Communicating with main thread​


s:
tp

●​ Scheduling delayed tasks​


ht

●​ Message-based background system​

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

●​ Long network calls​


n.

●​ Infinite loops​
di
ke
lin

Prevention
w.

●​ Use Coroutines (IO) for background work​


w
//w

●​ Avoid blocking main thread​


s:

●​ Profile performance​
tp
ht

31. What is the difference between Service,


IntentService, and JobIntentService?

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

●​ Backward-compatible alternative for background jobs​


co

●​ Uses JobScheduler for newer versions​


n.
di
ke

Use Cases
lin

Component Use Case


w.

Service Continuous tasks (music playback)


w

JobIntentServi Background tasks requiring guaranteed


//w

ce execution
s:

IntentService Legacy apps doing single background


tp

operations
ht

32. What is JobScheduler?


JobScheduler schedules background tasks based on conditions like:

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

●​ Delayed background work​


w.
w
//w
s:

33. What are SharedPreferences?


tp
ht

SharedPreferences store simple key-value pairs.

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.

●​ First-time user flags​


di
ke
lin
w.

34. What is DataStore and why replace


w

SharedPreferences?
//w
s:

DataStore is a modern, asynchronous, safer data storage solution using Coroutines +


tp

Flow.
ht

Why Better

●​ No ANRs (non-blocking)​

●​ Type-safe (Proto DataStore)​

Follow: [Link]
●​ Handles data consistency​

/
id
ro
Use Cases

nd
●​ Settings/preferences​

-a
nu
●​ User onboarding flags​

ha
●​ Lightweight configuration​

ris
/k
/in
m

35. What is Retrofit Interceptor?


co
n.

Interceptors intercept and modify HTTP requests/responses.


di
ke

Types
lin

●​ Application Interceptors​
w.

●​ Network Interceptors​
w
//w

Example
s:
tp

val interceptor = Interceptor { chain ->


ht

val req = [Link]().newBuilder().addHeader("Auth",


token).build()
[Link](req)
}

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

A sealed class restricts class inheritance to a fixed set of subclasses.


co

Why Important
n.
di

●​ Used for UI state representation​


ke

●​ Safer than enums for holding data​


lin
w.

●​ Great for state management in MVVM​


w
//w

Example
s:

sealed class UiState {


tp

object Loading : UiState()


ht

data class Success(val data: List<User>) : UiState()


data class Error(val message: String) : UiState()
}

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

●​ Use var only when value must change​


n.
di
ke
lin

38. What is Android Jetpack Compose?


w.
w

Jetpack Compose is a modern UI toolkit that uses a declarative programming model for
building Android UIs.
//w
s:

How It Works
tp

●​ UI is generated from immutable state​


ht

●​ Recomposition happens when state changes​

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.

39. What is the difference between XML UI and


di
ke

Compose UI?
lin

XML
w.
w

●​ Imperative​
//w

●​ View hierarchy​
s:
tp

●​ Requires Activity/Fragment for lifecycle​


ht

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

40. What is State Hoisting in Compose?


co
n.

State hoisting is the practice of moving state management to a higher-level component.


di
ke

Why Important
lin

●​ Makes UI stateless​
w.

●​ Supports reuse and testing​


w
//w

●​ Follow unidirectional data flow (UDF)​


s:
tp

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

●​ Business rules (Domain) never depend on UI​


n.
di

●​ Each layer communicates through interfaces​


ke
lin

Use Cases
w.

●​ Enterprise apps​
w
//w

●​ Large codebases​
s:
tp

●​ Testable apps​
ht

42. What is ADB (Android Debug Bridge)?

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

●​ Accessing device logs​


n.
di

●​ Installing/uninstalling apps​
ke
lin
w.
w

43. What is the purpose of [Link]?


//w

Manifest file defines essential information about the app for the Android system.
s:
tp

Contains
ht

●​ Activities, Services, BroadcastReceivers​

●​ 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

●​ Normal permissions (auto-granted)​


n.
di

●​ Dangerous permissions (require runtime approval)​


ke
lin

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

●​ Understanding shrink/optimize steps​


lin
w.

●​ Build optimization​
w
//w
s:
tp

46. What is ProGuard rule and why used?


ht

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

●​ Apps using many libraries​


lin
w.
w
//w

48. What is App Bundle (AAB)?


s:

AAB is a publishing format that contains all app resources, allowing Play Store to
tp

generate optimized APKs per device.


ht

Benefits

●​ Reduced app size​

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

●​ Real-time crash monitoring​


co

●​ Identifying critical issues​


n.
di

●​ Keeping app stability high​


ke
lin
w.
w

50. What is Lottie Animation?


//w
s:

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

A Retrofit Converter is responsible for converting HTTP request/response bodies into


n.

typed objects.
di
ke

Common Converters
lin

●​ GsonConverter​
w.

●​ MoshiConverter​
w
//w

●​ ScalarsConverter​
s:

●​ Kotlinx Serialization Converter​


tp
ht

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

52. What is Moshi and how is it different from


ke

Gson?
lin
w.

Difference
w
//w

Feature Gson Moshi


s:

Performance Slower Faster


tp

Kotlin support Moderat Excell


ht

e ent

Null safety Weak Strong

Reflection Heavy Lightw


eight

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

●​ Data loaded page-by-page​


n.
di

●​ Supports Room, Retrofit, etc.​


ke

●​ Works with Coroutines, Flow​


lin
w.

Example
w
//w

class UserPagingSource(...) : PagingSource<Int, User>()


s:
tp

Use Cases
ht

●​ Infinite scroll lists​

●​ Social media feeds​

●​ Large database tables​

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.

●​ API calls in ViewModel​


w
//w

●​ Database operations​
s:
tp

●​ UI state updates​
ht

55. What is LifecycleScope?

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

56. What is a Deep Link?


ke
lin

A deep link is a URL that opens a specific screen inside an app.


w.

Types
w
//w

●​ HTTP URLs​
s:

●​ Custom URI schemes (myapp://profile/10)​


tp
ht

●​ App Links (verified links)​

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.

●​ [Link] file on server​


di
ke

●​ Intent filter with autoVerify=true​


lin
w.

Use Cases
w
//w

●​ E-commerce deep linking​


s:

●​ Social media content links​


tp
ht

58. What are Work Constraints in WorkManager?


Constraints ensure a work request runs only when conditions are met.

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.

●​ Heavy background operations​


w
//w
s:
tp

59. What is Dagger/Hilt Scope?


ht

Scopes define how long a dependency lives.

Common Scopes

Follow: [Link]
●​ @Singleton → App-level​

/
id
ro
●​ @ActivityScoped​

nd
●​ @FragmentScoped​

-a
nu
●​ @ViewModelScoped​

ha
ris
Use Cases
/k
/in
●​ Reusing instances​
m

●​ Controlling object lifetime in DI graph​


co
n.
di
ke

60. What is a Coroutine Dispatcher?


lin
w.

Dispatchers determine which thread a coroutine runs on.


w
//w

Types
s:

●​ [Link] → UI​
tp

●​ [Link] → Network/database​
ht

●​ [Link] → CPU-bound​

●​ [Link] → Execution starts in current thread​

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

HandlerThread is a thread with its own Looper.


co

How It Works
n.
di

●​ Starts a new thread​


ke

●​ Looper handles message queue​


lin
w.

●​ Useful for serial background tasks​


w
//w

Example
s:

val thread = HandlerThread("BGThread").apply { start() }


tp

val handler = Handler([Link])


ht

Use Cases

●​ Background image processing​

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

●​ Small file size​


/k
/in
m

●​ Resolution-independent​
co

●​ Preferred for icons​


n.
di
ke

Use Cases
lin

●​ App icons​
w.

●​ Buttons and UI elements​


w
//w

●​ Animations (via AnimatedVectorDrawable)​


s:
tp
ht

63. What is ConstraintLayout and why is it


preferred?

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.

●​ Animations using MotionLayout​


di
ke
lin
w.

64. What is MotionLayout?


w
//w

MotionLayout is a layout for creating rich UI animations and transitions.


s:
tp

How It Works
ht

Uses a MotionScene XML to define:

●​ Start & end states​

●​ Constraints​

Follow: [Link]
●​ Interpolators​

/
id
ro
Use Cases

nd
●​ Interactive animations​

-a
nu
●​ Swipe gestures​

ha
●​ Login transitions​

ris
/k
/in
m

65. What is the Android RenderThread?


co
n.

RenderThread handles rendering UI elements independently from the main thread.


di
ke

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

●​ Consistent UI across Android versions​


ke
lin
w.
w

67. What is Shimmer Effect in Android?


//w
s:

Shimmer shows a placeholder loading animation when data is being fetched.


tp

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

Glide Most feature-rich


ke

Picass Old but simple


lin

o
w.
w

Use Cases
//w

●​ Loading remote images​


s:
tp

●​ Caching images​
ht

●​ Loading GIFs (Glide)​

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

70. What is a ViewState?


//w

ViewState is a data class representing the state of the UI at a given time.


s:
tp

Example
ht

data class LoginState(


val loading: Boolean = false,
val error: String? = null,
val success: Boolean = false
)

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

A broadcast is a system-wide event that apps can listen to.


co

Examples
n.
di

●​ Battery low​
ke

●​ Connectivity change​
lin
w.

●​ Boot completed​
w
//w

Use Cases
s:

●​ Reacting to system events​


tp
ht

●​ Receiving app-defined events​

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

val handler = CoroutineExceptionHandler { _, e ->


n.

Log.e("Error", [Link] ?: "")


di

}
ke
lin
w.

Use Cases
w

●​ API error handling​


//w

●​ Fail-safe background tasks​


s:
tp
ht

73. What is a Snackbar?


Snackbar is a lightweight message displayed at the bottom of the screen.

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

74. What is the difference between Dialog and


co

BottomSheetDialog?
n.
di

Feature Dialog BottomSheetDialog


ke

Position Center Bottom


lin

Behavior Static Draggable, expandable


w.
w

UX Traditional Modern UI
//w

pattern
s:

Use Cases
tp
ht

●​ Dialog: Alerts, confirmations​

●​ BottomSheet: Filters, share sheet, actions​

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

●​ Edit profile screens​


lin

●​ Real-time validation
w.
w
//w
s:

76. What is the difference between LiveData and


tp
ht

StateFlow?

Feature LiveData 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

●​ LiveData emits values only when the lifecycle is active.​


co

●​ StateFlow holds the latest state and emits on subscription.​


n.
di
ke

Use Cases
lin

●​ LiveData → legacy MVVM​


w.

●​ StateFlow → modern reactive architecture, Jetpack Compose​


w
//w
s:
tp
ht

77. What are Flow Operators in Kotlin?


Flow operators transform, combine, or filter emitted stream values.

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.

●​ API result transformation​


w
//w

●​ Combining API + database flows​


s:
tp
ht

78. What is a Foreground Service?


A service running in the foreground with a mandatory persistent notification.

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

79. What is Android Memory Leak?


//w

A memory leak occurs when objects that are no longer needed remain in memory.
s:
tp

Common Causes
ht

●​ Static references to Context​

●​ Long-running background tasks​

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.

80. What is LeakCanary?


di
ke

LeakCanary is a memory leak detection library.


lin

How It Works
w.
w

●​ Monitors Activity/Fragment lifecycle​


//w

●​ Detects leaked objects​


s:
tp

●​ Provides leak traces​


ht

Use Cases

●​ Debugging memory leaks​

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

●​ Implements business logic​


ke
lin

Example
w.

class UserRepository(
w

private val api: Api,


//w

private val dao: UserDao


) {
s:

suspend fun getUsers() = [Link]()


tp

}
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

●​ Compile-time SQL validation​


co

●​ 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

●​ Mapping Kotlin objects to DB rows​


ke
lin
w.
w

84. What is a DAO?


//w
s:

DAO defines database operations (insert, delete, update, query).


tp
ht

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

●​ Upload → process → sync​


//w

●​ Sequential background tasks​


s:
tp
ht

86. Explain Parcelable vs Serializable


Parcelable (Android recommended)

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

●​ Parcelable for passing models between Activities/Fragments​


ke
lin
w.
w

87. What is a DiffUtil in RecyclerView?


//w
s:

DiffUtil calculates list differences efficiently and updates only changed items.
tp

Example
ht

object UserDiff : [Link]<User>() {


override fun areItemsTheSame(old: User, new: User) = [Link]
== [Link]
}

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

●​ Complex multi-view RecyclerViews​


s:
tp
ht

89. What are WindowInsets?


WindowInsets represent system UI areas like:

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

90. What is the difference between buildTypes


ke
lin

and productFlavors?
w.

buildTypes
w
//w

●​ Debug vs Release​
s:

●​ Affects signing, minify, debuggable flag​


tp
ht

productFlavors

●​ Different versions of same app​

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:

●​ Debug performance issues​


tp

●​ Detect slow IO or network on main thread​


ht

92. What is Android Keystore?

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

93. What are Firebase Remote Configs?


m
co

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

94. What is EncryptedSharedPreferences?


Secure version of SharedPreferences that encrypts keys & values.

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

96. What is the difference between dp, sp, and


px?

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

97. What is Jetpack Navigation Component?


ke

Navigation Component handles in-app navigation with:


lin
w.

●​ NavGraph​
w

●​ NavHost​
//w
s:

●​ NavController​
tp
ht

Benefits

●​ SafeArgs (type-safe arguments)​

●​ Handles back stack​

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.

●​ Avoiding Bundle errors​


di
ke

●​ Compile-time argument safety​


lin
w.
w
//w

99. What is App Startup Library?


s:
tp

Library for managing initialization of components at app startup.


ht

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

●​ Eliminates overhead of lambda creation​


n.

●​ Used in higher-order functions​


di
ke

Example
lin

inline fun runSafe(block: () -> Unit) {


w.

try { block() } catch(e: Exception) {}


w

}
//w
s:

Use Cases
tp
ht

●​ High-performance functional operations​

●​ DSLs and builders

Follow: [Link]

You might also like