├── .gitignore
├── Android
├── Architecture
│ ├── Clean
│ │ └── clean_architecture_android.md
│ ├── MVC
│ │ └── mvc.md
│ ├── MVI
│ │ └── mvi.md
│ ├── MVP
│ │ └── mvp.md
│ └── MVVM
│ │ └── mvvm.md
├── Components
│ └── compoents.md
├── Data
│ ├── Realm
│ │ └── realm.md
│ ├── Room
│ │ └── room.md
│ └── SQLite
│ │ └── sqlite.md
├── Dependency Injection
│ ├── Dagger
│ │ └── dagger.md
│ ├── Hilt
│ │ └── hild.md
│ └── Koin
│ │ └── koin.md
├── Gradle
│ └── gradle.md
├── Java
│ ├── Advanced
│ │ └── adcvanced.md
│ └── Core
│ │ └── core-java.md
├── Jetpack Compose
│ └── compose.md
├── Jetpack
│ └── jetpack.md
├── Kotlin
│ ├── Coroutines
│ │ └── coroutines.md
│ ├── Flows
│ │ └── flows.md
│ ├── cheetsheet.md
│ └── kotlin.md
├── Libs
│ └── libs.md
├── Performance Optimazation
│ └── performance.md
├── Playstore
│ └── playstore.md
├── RX Java
│ └── rx.md
├── UX
│ └── ux.md
└── Ui
│ └── ui.md
├── Assets
├── devcrack.png
└── devcrack2.png
├── Backend Basics
├── APIs
│ └── apis.md
├── Firebase
│ └── firebase.md
├── GraphQL
│ └── graph.md
└── REST
│ └── rest.md
├── CONTRIBUTING.md
├── Cross Platform
├── Flutter
│ └── flutter.md
├── KMM
│ └── kmm.md
└── React Native
│ └── react.md
├── Design Patterns
└── design.md
├── ISSUE_TEMPLATE.md
├── Interviews
└── interview.md
├── License.md
├── PULL_REQUEST_TEMPLATE.md
├── ReadMe.md
├── SECURITY.md
├── System Design for Mobile
└── system_design.md
├── Testing
├── Espresso
│ └── espresso.md
├── JUnit
│ └── junit.md
├── Mockito
│ └── mokito.md
└── UIAutomator
│ └── ui_automater.md
├── Tools
├── CI CD
│ ├── ci_cd.md
│ └── fatlate.md
├── Charles
│ └── charles.md
├── Git
│ └── git.md
└── Postman
│ └── postman.md
└── iOS
├── Swift
└── swift.md
├── SwiftUI
└── swift_ui.md
└── UIKit basics
└── ui_kit_basics.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | *.log
4 | .idea/
5 | *.iml
--------------------------------------------------------------------------------
/Android/Architecture/Clean/clean_architecture_android.md:
--------------------------------------------------------------------------------
1 | # 🧼 Clean Architecture in Android
2 |
3 | ## 📘 Overview
4 |
5 | **Clean Architecture** is a software design pattern introduced by **Robert C. Martin (Uncle Bob)**. It promotes separation of concerns and independence of frameworks, UI, databases, and other external agencies. This makes the application more maintainable, testable, and scalable.
6 |
7 | ---
8 |
9 | ## 🧱 Layered Structure
10 |
11 | ```mermaid
12 | flowchart TD
13 | A[UI Layer] --> B[Presentation Layer]
14 | B --> C[Domain Layer]
15 | C --> D[Data Layer]
16 | D --> E[Framework Layer]
17 |
18 | ```
19 |
20 | ---
21 |
22 | ## 🧩 Layers Explained
23 |
24 | | Layer | Responsibility |
25 | |---------------|----------------|
26 | | **UI** | Displays data and observes `ViewModel` or `Presenter`. |
27 | | **Presentation** | Handles user actions, communicates with UseCases. ViewModel lives here. |
28 | | **Domain** | Contains business rules. UseCases are defined here. Framework-independent. |
29 | | **Data** | Implements repository interfaces defined in Domain. Talks to network or local DB. |
30 | | **Framework** | Includes actual implementations like Room, Retrofit, Firebase, etc. |
31 |
32 | ---
33 |
34 | ## 📦 Package Structure (Example)
35 |
36 | ```
37 | com.example.app
38 | ├── presentation
39 | │ └── viewmodel, ui, state
40 | ├── domain
41 | │ └── usecase, model, repository
42 | ├── data
43 | │ └── repository, api, db
44 | ├── di
45 | │ └── modules for Hilt/Koin
46 | └── utils
47 | ```
48 |
49 | ---
50 |
51 | ## 🔄 Data Flow
52 |
53 | 1. **UI** triggers an action (e.g., button click).
54 | 2. **ViewModel** calls a **UseCase**.
55 | 3. **UseCase** calls a **Repository** interface.
56 | 4. **Repository** is implemented in **Data Layer**.
57 | 5. **Data Source** (API/DB) is called.
58 | 6. Result is passed back to UI via ViewModel state.
59 |
60 | ---
61 |
62 | ## 🔐 Key Principles
63 |
64 | - **Dependency Rule**: Inner layers should never depend on outer layers.
65 | - **Inversion of Control**: Interfaces defined in inner layers and implemented in outer layers.
66 | - **Testability**: Domain and UseCases are easy to test as they are framework-agnostic.
67 |
68 | ---
69 |
70 | ## ✅ Benefits
71 |
72 | - Decoupled and modular architecture
73 | - Easier to test each layer
74 | - High maintainability
75 | - Scales well for large applications
76 |
77 | ---
78 |
79 | ## ⚠️ Challenges
80 |
81 | - May introduce boilerplate
82 | - Learning curve for small teams
83 | - Requires good understanding of abstraction and responsibility segregation
84 |
85 | ---
86 |
87 | ## 📘 Example UseCase
88 |
89 | ```kotlin
90 | class GetUserProfileUseCase(private val repository: UserRepository) {
91 | suspend operator fun invoke(userId: String): UserProfile {
92 | return repository.getUserProfile(userId)
93 | }
94 | }
95 | ```
96 |
97 | ---
98 |
99 | ## 🧠 Summary
100 |
101 | Clean Architecture enforces **separation of concerns** and makes your app **robust and testable** by following a strict layered structure. It is ideal for large-scale applications and teams working on long-term maintainable Android projects.
102 |
103 | # Comparison: Clean Architecture vs Other Architectures (MVVM, MVP)
104 |
105 | | Aspect | Clean Architecture | MVVM (Model-View-ViewModel) | MVP (Model-View-Presenter) |
106 | |----------------------|-------------------------------------------------|---------------------------------------------------|------------------------------------------------|
107 | | **Main Idea** | Separation of concerns into layers (Domain, Data, Presentation) with clear dependency rules. | Separation of UI (View) and business logic (ViewModel) with LiveData or StateFlow. | Separates View and Presenter, where Presenter handles UI logic and communicates with Model. |
108 | | **Layers** | 1. **Entities (Domain layer)** 2. **Use Cases / Interactors** 3. **Interface Adapters / Presenters** 4. **Framework & Drivers (UI, DB, Network)** | Usually 3 layers: 1. Model 2. View 3. ViewModel | 3 layers: 1. Model 2. View 3. Presenter |
109 | | **Dependency Rule** | Inner layers should never depend on outer layers; dependencies point inward. | View depends on ViewModel; ViewModel depends on Model or Repository. | View depends on Presenter; Presenter depends on Model/Repository. |
110 | | **Testability** | High - business logic is isolated in domain/use case layer. | Moderate to high - ViewModel can be tested separately from View. | Moderate - Presenter can be tested, but View is often harder to isolate. |
111 | | **UI Framework Dependency** | UI frameworks are in the outermost layer; domain and use cases are independent of Android. | ViewModel can contain Android-specific code but often kept Android-agnostic for testability. | Presenter usually contains Android UI logic but aims to be platform-independent. |
112 | | **Code Complexity** | Higher initial complexity due to many layers and interfaces. | Moderate complexity; easier to start with but can grow large. | Moderate complexity but can lead to tight coupling if not careful. |
113 | | **Typical Use Cases** | Large, complex apps where long-term maintenance and testability are important. | Apps with dynamic UI updates and reactive data streams, e.g., using Jetpack libraries. | Apps with simpler UI and logic separation needs, common before MVVM popularity. |
114 | | **Examples in Android** | Using Use Cases + Repositories + Clean separation + Dependency Injection (Hilt/Dagger) | Using Jetpack Compose or XML with ViewModel + LiveData/Flow | Using Activities/Fragments as Views + Presenter classes handling logic |
115 |
116 | ---
117 |
118 | ### Summary
119 |
120 | - **Clean Architecture** focuses on strict layering and separation of concerns with clear rules on dependencies to keep business logic isolated from UI and frameworks. It’s ideal for maintainable, scalable, and testable large apps.
121 | - **MVVM** is simpler, focuses on reactive UI data binding, and fits well with Jetpack Compose and Android Architecture Components.
122 | - **MVP** separates UI and logic but often leads to more boilerplate and can become tightly coupled without careful design.
123 |
124 | ---
125 |
126 |
--------------------------------------------------------------------------------
/Android/Architecture/MVC/mvc.md:
--------------------------------------------------------------------------------
1 | # MVC Architecture in Android
2 |
3 | The Model-View-Controller (MVC) architecture is a design pattern commonly used in Android development to organize code in a modular, maintainable, and testable way.
4 | MVC divides an application into three interconnected components:
5 |
6 | ## 1. **Model Layer**
7 | A. This model layer, responsible for managing the business logic and handling network or database API.
8 | B. The Model has no knowledge of the user interface.
9 | C. This component stores the application data.
10 | 1. Data sources (e.g., Room database, SQLite, Firebase, APIs).
11 | 2. Repository classes that handle data operations.
12 | 3. Business logic (e.g., calculations, data transformations).
13 | Example:
14 | A User class or a repository fetching user data from a server.
15 | class TaskRepository {
16 | private val tasks = mutableListOf()
17 | fun addTask(task: Task) { tasks.add(task) }
18 | fun getTasks(): List = tasks
19 | }
20 |
21 | ## 2. **View Layer**
22 | A. Represents the UI layer, responsible for displaying data to the user and capturing user input.
23 | B. In Android this is typically XML layouts, custom Views, ViewGroups, and UI widgets.
24 | C. The View doesn’t handle any complex logic itself.
25 | 1. XML layouts (defining UI components like TextView, RecyclerView).
26 | 2. UI elements in Activities, Fragments, or ViewHolders.
27 | Example:
28 | The View is passive and only displays what the Controller tells it to, without directly interacting with the Model.
29 | An Activity displaying a list of users in a RecyclerView.
30 |
31 |
32 |
33 |
34 |
35 |
36 | ## 3. **Controller Layer**
37 | A. This component establishes the relationship between the View and the Model.
38 | B. Handles user input from the View, updates the Model, and refreshes the View with new data.
39 | C. It contains the core application logic and gets informed of the user’s behavior and updates the Model as per the need.
40 | 1. Activities, Fragments, or custom classes.
41 | 2. It processes user interactions (e.g., button clicks) and coordinates with the Model to fetch or update data.
42 | Example:
43 | An Activity that listens for a button click, calls the Model to fetch data, and updates the View.
44 |
45 | class MainActivity : AppCompatActivity() {
46 | private val repository = TaskRepository()
47 | private lateinit var recyclerView: RecyclerView
48 |
49 | override fun onCreate(savedInstanceState: Bundle?) {
50 | super.onCreate(savedInstanceState)
51 | setContentView(R.layout.activity_main)
52 | recyclerView = findViewById(R.id.recyclerView)
53 | recyclerView.adapter = TaskAdapter(repository.getTasks())
54 |
55 | findViewById(R.id.addButton).setOnClickListener {
56 | val newTask = Task(id = tasks.size + 1, title = "New Task")
57 | repository.addTask(newTask)
58 | recyclerView.adapter?.notifyDataSetChanged()
59 | }
60 | }
61 | }
62 |
63 | ## Advantages of MVC in Android
64 | 1. Separation of Concerns: Each component (Model, View, Controller) has a distinct role, improving code organization.
65 | 2. Maintainability: Changes to one component (e.g., UI) don’t affect others.
66 | 3. Testability: The Model can be tested independently of the UI.
67 | 4. Reusability: Models and business logic can be reused across different Views or Controllers.
68 |
69 | ## Disadvantages of MVC in Android
70 | 1. Complexity: For small apps, MVC can add unnecessary complexity.
71 | 2. Tight Coupling: In Android, Activities/Fragments often act as both View and Controller, leading to potential coupling.
72 | 3. Boilerplate Code: Implementing MVC may require more code compared to simpler approaches.
73 | 4. Not Ideal for Large Apps: MVC can become cumbersome in complex apps, where patterns like MVVM or MVI are often preferred.
74 |
75 | ## When to Use MVC in Android
76 | 1. Suitable for small to medium-sized apps with straightforward UI and logic.
77 | 2. Less ideal for complex apps where reactive patterns (MVVM, MVI) or Jetpack components (LiveData, ViewModel) are preferred.
78 |
79 | ## Interview Questions for Experienced Android Developers (MVC Focus)
80 |
81 | 1. ## Conceptual Questions
82 |
83 | ### 1. What is the MVC architecture, and how is it implemented in Android?
84 | 1. Explain the roles of Model, View, and Controller with Android-specific examples (e.g., Room for Model, Activity/Fragment for Controller, XML layouts for View).
85 | 2. Discuss the flow of data and user interaction.
86 |
87 | ### 2. What are the advantages and disadvantages of using MVC in Android?
88 | 1. Highlight separation of concerns, testability, and maintainability as advantages.
89 | 2. Mention complexity, potential tight coupling in Activities/Fragments, and scalability issues as disadvantages.
90 |
91 | ### 3. How does MVC differ from MVVM and MVI in Android?
92 | 1. Compare the roles of Controller (MVC) vs. ViewModel (MVVM) vs. Intent/State (MVI).
93 | 2. Emphasize MVVM’s use of data binding/LiveData and MVI’s unidirectional data flow.
94 |
95 | ### 4. How do you handle communication between the Model and Controller in MVC?
96 | 1. Discuss using interfaces, callbacks, or reactive streams (e.g., RxJava, Coroutines) to fetch data from the Model and update the View via the Controller.
97 |
98 | ### 5. What challenges have you faced while implementing MVC in Android projects?
99 | 1. Mention issues like tight coupling between View and Controller, managing complex UI logic, or testing challenges.
100 | 2. Provide real-world examples and solutions.
101 |
102 | 2. ## Technical/Implementation Questions
103 |
104 | ### 1. How would you structure an Android app using MVC for a to-do list feature?
105 | 1. Describe a Model (e.g., Room database with a Task entity), View (XML with RecyclerView), and Controller (Activity/Fragment handling user input and updating the UI).
106 | 2. Include code snippets if possible.
107 |
108 | ### 2. How do you avoid tight coupling between View and Controller in MVC?
109 | 1. Suggest using interfaces or dependency injection (e.g., Dagger/Hilt) to decouple components.
110 | 2. Mention separating business logic into repositories or services.
111 |
112 | ### 3. How would you handle asynchronous operations (e.g., API calls) in an MVC-based Android app?
113 | 1. Explain using Coroutines, RxJava, or AsyncTask in the Controller to call the Model’s repository, which fetches data asynchronously and updates the View via callbacks or LiveData.
114 |
115 | ### 4. How do you test an MVC-based Android app?
116 | 1. Discuss unit testing the Model (e.g., repository logic with JUnit/Mockito), UI testing the View (e.g., Espresso), and integration testing for Controller interactions. Highlight dependency injection for mocking.
117 |
118 | ### 5. How would you refactor an MVC-based app to MVVM?
119 | 1. Replace the Controller with a ViewModel, use LiveData or StateFlow for reactive updates, and leverage data binding or Jetpack components.
120 | 2. Explain the benefits of reduced coupling and better lifecycle handling.
121 |
122 | 3. ## Scenario-Based Questions
123 |
124 | ### 1. Suppose you’re tasked with building a feature to display a list of users from an API in an MVC-based app. How would you design it?
125 | 1. Outline the Model (repository fetching users from Retrofit), View (RecyclerView with XML layout), and Controller (Activity/Fragment handling API calls and updating the UI).
126 | 2. Include error handling and loading states.
127 |
128 | ### 2. In an MVC app, the Activity is becoming too large due to complex logic. How would you address this?
129 | 1. Suggest moving business logic to the Model (e.g., repository or service classes), using dependency injection, or splitting the Activity into smaller Fragments or custom Controllers.
130 |
131 | ### 3. How would you handle configuration changes (e.g., screen rotation) in an MVC-based app?
132 | 1. Discuss saving state in the Model, using onSaveInstanceState, or leveraging ViewModel (if hybridizing with MVVM) to persist data across configuration changes.
133 |
134 | ### 4. You’re working on an MVC app, and the client requests offline support. How would you implement it?
135 | 1. Modify the Model to include a local database (e.g., Room) for caching data. Implement a repository pattern to handle online/offline data sources and sync logic.
136 |
137 | ### 5. How would you integrate a third-party library (e.g., Retrofit) into an MVC-based Android app?
138 | 1. Place Retrofit calls in the Model’s repository, use the Controller to initiate requests, and update the View with the response. Include dependency injection for cleaner integration.
139 |
140 | 4. ## Advanced Questions
141 |
142 | ### 1. How do you handle dependency injection in an MVC-based Android app?
143 | 1. Explain using Dagger/Hilt to inject dependencies (e.g., repository into Controller).
144 | 2. Discuss benefits like easier testing and reduced coupling.
145 |
146 | ### 2. What are the limitations of using Activities/Fragments as Controllers in MVC?
147 | 1. Highlight tight coupling, lifecycle complexity, and difficulty testing UI-heavy logic.
148 | 2. Suggest solutions like custom Controller classes or moving to MVVM.
149 |
150 | ### 3. How do you ensure thread safety in an MVC app when updating the UI?
151 | 1. Use Coroutines with Dispatchers.Main for UI updates, or RxJava’s observeOn(AndroidSchedulers.mainThread()).
152 | 2. Ensure background tasks run on Dispatchers.IO.
153 |
154 | ### 4. How would you optimize an MVC app for performance?
155 | 1. Discuss lazy loading data, caching in the Model, minimizing View updates (e.g., using DiffUtil in RecyclerView), and optimizing Controller logic with Coroutines or RxJava.
156 | ### 5. Have you ever migrated an MVC-based app to a different architecture? Why and how?
157 | 1. Share a real-world example (e.g., moving to MVVM for better lifecycle handling).
158 | 2. Explain the migration process, challenges (e.g., refactoring Controllers to ViewModels), and benefits.
159 |
--------------------------------------------------------------------------------
/Android/Architecture/MVI/mvi.md:
--------------------------------------------------------------------------------
1 | # MVI Architecture
2 |
3 | ## ✅ What is MVI?
4 |
5 | **MVI (Model-View-Intent)** is an architectural pattern primarily used in modern Android development (especially with **Jetpack Compose**, **Kotlin**, and **unidirectional data flow** paradigms). It's inspired by **The Elm Architecture** and **Redux**.
6 |
7 | MVI focuses on **single-direction data flow** and **immutable state** management.
8 |
9 | ---
10 |
11 | ## 🔄 Flow Overview
12 |
13 | Intent (User Action)
14 | ↓
15 | ViewModel processes Intent
16 | ↓
17 | Model (Business Logic & State)
18 | ↓
19 | Emits new ViewState
20 | ↓
21 | View renders the ViewState
22 |
23 | ## 🧩 Components of MVI
24 |
25 | | Component | Responsibility |
26 | |----------------|----------------------------------------------------------------------------------|
27 | | **Intent** | User actions (e.g., button click, text input). |
28 | | **Model** | Processes intents into new **states** via business logic and data layer. |
29 | | **ViewState** | Immutable state representing the entire UI. |
30 | | **View** | Observes state and renders the UI. |
31 |
32 | ---
33 |
34 | ## 🧠 Core Principles
35 |
36 | - **Unidirectional Data Flow**: Data flows in a single direction, making state management predictable.
37 | - **Immutable State**: The entire UI state is stored in one object. When changes occur, a new copy is created.
38 | - **Pure Functions**: Transformations from intent to state are done via pure functions (no side effects).
39 |
40 | ---
41 |
42 | ## 📱 Example (Login Screen)
43 |
44 | 1. **User types in email** → `Intent.EmailChanged("user@example.com")`
45 | 2. **User clicks login** → `Intent.SubmitLogin`
46 | 3. **ViewModel** handles the intent and produces new **ViewState**
47 | 4. **View** observes `ViewState` and updates UI accordingly
48 |
49 | ---
50 |
51 | ## ✅ Benefits of MVI
52 |
53 | - Easier **testing** due to pure functions and clear state.
54 | - Predictable and **reliable UI behavior**.
55 | - Great for **real-time UI updates** (chat apps, forms, etc.).
56 | - Scales well in **complex UIs** with multiple states.
57 |
58 | ---
59 |
60 | ## ⚠️ Considerations
61 |
62 | - More **boilerplate** compared to simpler patterns.
63 | - Can be **overkill for very small UIs**.
64 | - Requires careful **state design** and memory management.
65 |
66 | ---
67 |
68 | ## 🔄 Comparison with MVC & MVVM
69 |
70 | | Pattern | Data Flow | State | Testability | Used In |
71 | |--------|---------------------|------------------|-------------|-------------------|
72 | | MVC | Bidirectional | Mutable | Medium | Web/legacy Android|
73 | | MVVM | Bidirectional (LiveData/Binding) | Mutable | Good | Modern Android |
74 | | MVI | Unidirectional | Immutable | Excellent | Compose, Redux |
75 |
76 |
--------------------------------------------------------------------------------
/Android/Architecture/MVP/mvp.md:
--------------------------------------------------------------------------------
1 | # MVP Architecture
2 |
3 | ## ✅ What is MVP?
4 |
5 | **MVP (Model-View-Presenter)** is a design pattern used to separate the presentation layer from the business logic. It’s commonly used in Android development, especially with XML-based UI (pre-Jetpack Compose).
6 |
7 | It improves testability and code organization by decoupling UI from business logic.
8 |
9 | ---
10 |
11 | ## 🔄 Flow Overview
12 | User interacts with View
13 | ↓
14 | View forwards input to Presenter
15 | ↓
16 | Presenter processes logic, updates Model
17 | ↓
18 | Model returns data to Presenter
19 | ↓
20 | Presenter updates the View
21 |
22 |
23 | ---
24 |
25 | ## 🧩 Components of MVP
26 |
27 | | Component | Responsibility |
28 | |-------------|----------------------------------------------------------------------------------|
29 | | **Model** | Handles business logic, data operations, API calls, and database interactions. |
30 | | **View** | Interface representing the UI (Activity/Fragment or custom View). |
31 | | **Presenter**| Acts as a middleman. Fetches data from the Model and updates the View. |
32 |
33 | ---
34 |
35 | ## 📱 Example (Login Flow)
36 |
37 | 1. **User** enters email/password → `View` sends data to `Presenter`
38 | 2. **Presenter** validates input, requests login from `Model`
39 | 3. **Model** returns success or failure
40 | 4. **Presenter** tells `View` to show result (e.g., success message or error)
41 |
42 | ---
43 |
44 | ## ✅ Benefits
45 |
46 | - **Improved testability**: Business logic is in Presenter, which can be unit tested easily.
47 | - **Separation of concerns**: Clear boundaries between UI and logic.
48 | - **Reusable View and Presenter contracts**: Easier to swap UI components.
49 |
50 | ---
51 |
52 | ## ⚠️ Drawbacks
53 |
54 | - Can lead to **boilerplate code**, especially with large View interfaces.
55 | - The **Presenter** can become large if not well-structured (known as "God class").
56 | - Manual **View-to-Presenter** binding can be tedious.
57 |
58 | ---
59 |
60 | ## 🔄 Comparison with MVC & MVVM & MVI
61 |
62 | | Pattern | Data Flow | State Type | Testability | Common Use Case |
63 | |--------|----------------------|--------------|-------------|---------------------------|
64 | | MVC | Bidirectional | Mutable | Medium | Legacy systems/web |
65 | | MVP | View → Presenter → Model | Mutable | Good | Android (pre-Compose) |
66 | | MVVM | View ↔ ViewModel (LiveData) | Mutable | Very Good | Modern Android XML |
67 | | MVI | Intent → Model → ViewState → View | Immutable | Excellent | Jetpack Compose/Redux |
68 |
69 | ---
70 |
71 | ## 🛠️ Sample Interface Contracts
72 |
73 | ```kotlin
74 | // View
75 | interface LoginView {
76 | fun showLoading()
77 | fun hideLoading()
78 | fun showError(message: String)
79 | fun navigateToHome()
80 | }
81 |
82 | // Presenter
83 | interface LoginPresenter {
84 | fun onLoginClicked(email: String, password: String)
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/Android/Architecture/MVVM/mvvm.md:
--------------------------------------------------------------------------------
1 | # MVVM Architecture
2 |
3 | ## ✅ What is MVVM?
4 |
5 | **MVVM (Model-View-ViewModel)** is a software architectural pattern used in modern Android development. It enables a **separation of concerns** between the UI (View), the business logic/data (Model), and the intermediary (ViewModel).
6 |
7 | MVVM is ideal for **data binding**, **lifecycle-aware components**, and **unit testing** in Android applications.
8 |
9 | ---
10 |
11 | ## 🔄 MVVM Flow (Mermaid Diagram)
12 |
13 | ```mermaid
14 | flowchart TD
15 | A[User Interaction in View] --> B[View observes LiveData or StateFlow]
16 | B --> C[ViewModel]
17 | C --> D[Model: Repository/UseCase/DB/API]
18 | D --> E[Returns data to ViewModel]
19 | E --> F[ViewModel updates LiveData or StateFlow]
20 | F --> G[View re-renders with new data]
21 | ```
22 |
23 | ---
24 |
25 | ## 🧩 Components of MVVM
26 |
27 | | Component | Responsibility |
28 | |--------------|----------------------------------------------------------------------------------|
29 | | **Model** | Handles data-related operations: network, DB, preferences, etc. |
30 | | **View** | Displays UI. Observes `LiveData`, `StateFlow`, or `Compose` state. |
31 | | **ViewModel** | Exposes data to the UI and handles business logic. Survives configuration changes. |
32 |
33 | ---
34 |
35 | ## 🧠 Key Concepts
36 |
37 | - **Unidirectional Data Flow**: View observes state, but never pushes changes directly to the Model.
38 | - **LiveData / StateFlow / Compose State**: Used for reactive UI updates.
39 | - **Lifecycle Awareness**: ViewModel is lifecycle-aware and survives orientation changes.
40 |
41 | ---
42 |
43 | ## 📱 Example Flow (Search UI)
44 |
45 | 1. **User types** a query → View calls `viewModel.onSearch("query")`
46 | 2. **ViewModel** calls repository `searchItems("query")`
47 | 3. **Repository** fetches data from API or cache
48 | 4. **Result** is returned to ViewModel
49 | 5. **ViewModel** updates the `LiveData` or `StateFlow`
50 | 6. **View** automatically re-renders UI with new list
51 |
52 | ---
53 |
54 | ## ✅ Benefits of MVVM
55 |
56 | - Easy to **test ViewModel** separately.
57 | - Clean separation of UI and logic.
58 | - Works well with **Jetpack Compose**, **LiveData**, and **Kotlin Flows**.
59 | - **Lifecycle-aware** via ViewModel and other Jetpack components.
60 |
61 | ---
62 |
63 | ## ⚠️ Drawbacks
64 |
65 | - May require boilerplate for `sealed classes`, `UIState`, `Events`.
66 | - Overuse of ViewModel for too much logic can cause a "fat ViewModel".
67 | - Requires understanding of reactive streams (LiveData, Flow, etc.)
68 |
69 | ---
70 |
71 | ## 🔄 Comparison Summary
72 |
73 | | Pattern | Data Flow | Lifecycle-Aware | Testability | UI Tech |
74 | |--------|------------------------|------------------|-------------|------------------|
75 | | MVC | Bidirectional | ❌ | Medium | Web/legacy apps |
76 | | MVP | View → Presenter → Model | ❌ | Good | XML Android |
77 | | MVVM | View ←→ ViewModel ←→ Model | ✅ | Excellent | XML & Compose |
78 | | MVI | Unidirectional (State) | ✅ | Excellent | Jetpack Compose |
79 |
80 | ---
81 |
82 | ## 🛠️ Sample Code Snippets
83 |
84 | ### ViewModel
85 |
86 | ```kotlin
87 | class SearchViewModel(
88 | private val repository: SearchRepository
89 | ) : ViewModel() {
90 |
91 | private val _uiState = MutableStateFlow(SearchUiState.Idle)
92 | val uiState: StateFlow = _uiState.asStateFlow()
93 |
94 | fun onSearch(query: String) {
95 | viewModelScope.launch {
96 | _uiState.value = SearchUiState.Loading
97 | try {
98 | val results = repository.search(query)
99 | _uiState.value = SearchUiState.Success(results)
100 | } catch (e: Exception) {
101 | _uiState.value = SearchUiState.Error(e.message ?: "Unknown error")
102 | }
103 | }
104 | }
105 | }
106 | ```
107 |
108 | ### UI State
109 |
110 | ```kotlin
111 | sealed class SearchUiState {
112 | object Idle : SearchUiState()
113 | object Loading : SearchUiState()
114 | data class Success(val items: List) : SearchUiState()
115 | data class Error(val message: String) : SearchUiState()
116 | }
117 | ```
118 |
119 | ---
120 |
121 | ## ✅ Summary
122 |
123 | MVVM is the recommended architecture for **modern Android apps**, especially when using:
124 |
125 | - Jetpack Compose
126 | - Lifecycle-aware components
127 | - Kotlin coroutines and Flow
128 | - Clean Architecture
129 |
130 | It leads to **cleaner**, **testable**, and **maintainable** code.
131 |
--------------------------------------------------------------------------------
/Android/Components/compoents.md:
--------------------------------------------------------------------------------
1 | # Android Components: Interview Questions & Answers
2 |
3 | ## What are Android components?
4 |
5 | Android components are the essential building blocks of an Android application. Each component is a different point through which the system can enter your app. The main Android components are:
6 |
7 | - **Activities**
8 | - **Services**
9 | - **Broadcast Receivers**
10 | - **Content Providers**
11 |
12 | ---
13 |
14 | ### 1. What is an Activity?
15 |
16 | **Answer:**
17 | An Activity represents a single screen with a user interface. It is like a window or a page in an app. Activities handle user interaction and navigation between screens.
18 |
19 | #### Activity Lifecycle Methods with Flow
20 |
21 | The typical flow of an Activity's lifecycle is as follows:
22 |
23 | ```mermaid
24 | graph TD
25 | A(onCreate) --> B(onStart)
26 | B --> C(onResume)
27 | C --> D(Activity Running)
28 | D --> E(onPause)
29 | E --> F(onStop)
30 | F --> G(onDestroy)
31 | E --> C
32 | F --> B
33 | ```
34 |
35 | - **onCreate()**: Called when the activity is first created. Initialize resources here.
36 | - **onStart()**: Called when the activity becomes visible to the user.
37 | - **onResume()**: Called when the activity starts interacting with the user.
38 | - **onPause()**: Called when the system is about to start resuming another activity.
39 | - **onStop()**: Called when the activity is no longer visible.
40 | - **onDestroy()**: Called before the activity is destroyed.
41 |
42 | This flow ensures proper resource management and user experience as the activity transitions between states.
43 |
44 | ---
45 |
46 | ### 2. What is a Service?
47 |
48 | **Answer:**
49 | A Service is a component that runs in the background to perform long-running operations. It does not provide a user interface. Examples include playing music or fetching data from the network.
50 |
51 | ---
52 |
53 | ### 3. What is a Broadcast Receiver?
54 |
55 | **Answer:**
56 | A Broadcast Receiver responds to system-wide broadcast announcements. Apps can register to receive specific broadcasts, such as when the device is charging or when the network connectivity changes.
57 |
58 | ---
59 |
60 | ### 4. What is a Content Provider?
61 |
62 | **Answer:**
63 | A Content Provider manages access to a structured set of data. It allows data sharing between different applications. Examples include the Contacts or MediaStore providers.
64 |
65 | ---
66 |
67 | ### 5. What is the role of the AndroidManifest.xml file?
68 |
69 | **Answer:**
70 | The `AndroidManifest.xml` file declares all the components of the application and their capabilities. It is required for the system to know about the components and how to launch them.
71 |
72 | ---
73 |
74 | ### 6. Can you explain the lifecycle of an Activity?
75 |
76 | **Answer:**
77 | The Activity lifecycle includes states such as `onCreate()`, `onStart()`, `onResume()`, `onPause()`, `onStop()`, and `onDestroy()`. These methods allow developers to manage resources and handle user interactions appropriately.
78 |
79 | ---
80 |
81 | ### 7. How do Services differ from Activities?
82 |
83 | **Answer:**
84 | Services run in the background without a user interface, while Activities interact with the user. Services are used for tasks that need to continue even if the user is not interacting with the app.
85 |
86 | ---
87 |
88 | ### 8. How do you communicate between components?
89 |
90 | **Answer:**
91 | Components communicate using **Intents**. Intents can be explicit (targeting a specific component) or implicit (requesting any component that can handle the action).
92 |
93 | ---
94 |
95 | ### 9. What are the different types of Services in Android?
96 |
97 | **Answer:**
98 | There are three main types of services:
99 | - **Foreground Service:** Performs operations noticeable to the user, such as playing music. It must display a notification.
100 | - **Background Service:** Performs tasks not directly noticed by the user. Subject to background execution limits in recent Android versions.
101 | - **Bound Service:** Allows components (like activities) to bind to the service and interact with it via a client-server interface.
102 |
103 | ---
104 |
105 | ### 10. How do you start and stop a Service?
106 |
107 | **Answer:**
108 | You start a service using `startService(Intent)` or `bindService(Intent, ServiceConnection, int)`.
109 | To stop a service, call `stopService(Intent)` or `stopSelf()` from within the service. Bound services are stopped when all clients unbind.
110 |
111 | ---
112 |
113 | ### 11. What is a Bound Service and how is it implemented?
114 |
115 | **Answer:**
116 | A Bound Service allows components to bind and interact with it. It is implemented by overriding `onBind()` in the Service class and returning an `IBinder` interface for communication. Clients use this binder to call public methods in the service.
117 |
118 | ---
119 |
120 | ### 12. How do you run a Service in the foreground?
121 |
122 | **Answer:**
123 | Call `startForeground()` within the service, passing a notification. This keeps the service running even under memory pressure and informs the user that the service is active.
124 |
125 | ---
126 |
127 | ### 13. What are the lifecycle methods of a Service?
128 |
129 | **Answer:**
130 | Key lifecycle methods include:
131 | - `onCreate()`: Called when the service is first created.
132 | - `onStartCommand()`: Called each time the service is started.
133 | - `onBind()`: Called when a component binds to the service.
134 | - `onUnbind()`: Called when all clients have unbound.
135 | - `onDestroy()`: Called when the service is destroyed.
136 |
137 | ---
138 |
139 | ### 14. How does Android handle service limitations in recent versions?
140 |
141 | **Answer:**
142 | Recent Android versions impose restrictions on background services to improve battery life. Apps must use foreground services for long-running tasks, and background execution is limited unless the app is in the foreground or has special permissions.
143 |
144 | ---
145 |
146 | ### 15. What are some best practices for using Services?
147 |
148 | **Answer:**
149 | - Use foreground services for user-noticeable tasks.
150 | - Release resources in `onDestroy()`.
151 | - Avoid long-running operations on the main thread; use worker threads.
152 | - Handle service restarts gracefully using `START_STICKY`, `START_NOT_STICKY`, or `START_REDELIVER_INTENT` in `onStartCommand()`.
153 |
154 | ---
155 |
156 | ### 16. What are the launch modes of an Activity?
157 |
158 | **Answer:**
159 | Android supports four launch modes for activities, defined in the manifest or via intent flags:
160 | - **standard:** Default mode; a new instance is created each time.
161 | - **singleTop:** If the activity is already at the top, no new instance is created.
162 | - **singleTask:** Only one instance exists in the task; if it exists, it is brought to the front.
163 | - **singleInstance:** The activity is the only one in its task; other activities launch in a new task.
164 |
165 | ---
166 |
167 | ### 17. How do you pass data between Activities?
168 |
169 | **Answer:**
170 | Data is passed using `Intent` extras. Use `putExtra()` to add data and `getIntent().getExtras()` or `getIntent().getStringExtra()` to retrieve it in the target activity.
171 |
172 | ---
173 |
174 | ### 18. What is the difference between onSaveInstanceState() and onRestoreInstanceState()?
175 |
176 | **Answer:**
177 | `onSaveInstanceState()` is called before an activity may be destroyed to save UI state. `onRestoreInstanceState()` is called after `onStart()` to restore the saved state. This helps preserve data during configuration changes like rotation.
178 |
179 | ---
180 |
181 | ### 19. How do you handle configuration changes in Activities?
182 |
183 | **Answer:**
184 | Override `onConfigurationChanged()` or use `android:configChanges` in the manifest to handle changes manually. Alternatively, rely on the default behavior and save/restore state using `onSaveInstanceState()` and `onRestoreInstanceState()`.
185 |
186 | ---
187 |
188 | ### 20. How do you share data between apps using a Content Provider?
189 |
190 | **Answer:**
191 | Content Providers expose data using a URI. Other apps access data via `ContentResolver` methods like `query()`, `insert()`, `update()`, and `delete()`, using the provider's URI.
192 |
193 | ---
194 |
195 | ### 21. How do you implement a custom Content Provider?
196 |
197 | **Answer:**
198 | Extend the `ContentProvider` class and override methods: `onCreate()`, `query()`, `insert()`, `update()`, `delete()`, and `getType()`. Register the provider in `AndroidManifest.xml` with a unique authority.
199 |
200 | ---
201 |
202 | ### 22. How do you secure a Content Provider?
203 |
204 | **Answer:**
205 | Restrict access using permissions in the manifest. Use `android:exported="false"` to limit access to your app, or define custom permissions for read/write operations.
206 |
207 | ---
208 |
209 | ### 23. What is a URI Matcher in Content Providers?
210 |
211 | **Answer:**
212 | A `UriMatcher` helps map incoming URI patterns to integer codes, making it easier to handle different types of queries or operations in the provider's methods.
213 |
214 | ---
215 |
216 | ### 24. How do you notify data changes in a Content Provider?
217 |
218 | **Answer:**
219 | Call `getContext().getContentResolver().notifyChange(uri, null)` after modifying data. Registered observers (like cursors or loaders) will be notified to update their data.
220 |
221 |
222 | ---
223 |
224 | ## Summary Table
225 |
226 | | Component | Purpose | UI? |
227 | |--------------------|-----------------------------------------|-------|
228 | | Activity | User interaction, UI screens | Yes |
229 | | Service | Background tasks | No |
230 | | Broadcast Receiver | Respond to system/app broadcasts | No |
231 | | Content Provider | Data sharing between apps | No |
232 |
--------------------------------------------------------------------------------
/Android/Data/Realm/realm.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Data/Realm/realm.md
--------------------------------------------------------------------------------
/Android/Data/Room/room.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Data/Room/room.md
--------------------------------------------------------------------------------
/Android/Data/SQLite/sqlite.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Data/SQLite/sqlite.md
--------------------------------------------------------------------------------
/Android/Dependency Injection /Dagger/dagger.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Dependency Injection /Dagger/dagger.md
--------------------------------------------------------------------------------
/Android/Dependency Injection /Hilt/hild.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Dependency Injection /Hilt/hild.md
--------------------------------------------------------------------------------
/Android/Dependency Injection /Koin/koin.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Dependency Injection /Koin/koin.md
--------------------------------------------------------------------------------
/Android/Gradle/gradle.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Gradle/gradle.md
--------------------------------------------------------------------------------
/Android/Java/Advanced/adcvanced.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Java/Advanced/adcvanced.md
--------------------------------------------------------------------------------
/Android/Java/Core/core-java.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Java/Core/core-java.md
--------------------------------------------------------------------------------
/Android/Jetpack Compose/compose.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Jetpack Compose/compose.md
--------------------------------------------------------------------------------
/Android/Jetpack/jetpack.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Jetpack/jetpack.md
--------------------------------------------------------------------------------
/Android/Kotlin/Coroutines/coroutines.md:
--------------------------------------------------------------------------------
1 | # Kotlin Coroutines
2 | Coroutines in Kotlin are lightweight, asynchronous programming constructs that simplify concurrency by allowing developers to write sequential-looking code while avoiding callback hell. They are managed by Kotlin’s runtime (not OS threads), making them efficient for tasks like network calls or database operations. Coroutines integrate with Android’s lifecycle (via viewModelScope or lifecycleScope) to ensure structured concurrency and prevent memory leaks.
3 |
4 | ## 1. Coroutine Scopes
5 | **What They Are:**
6 | Scopes define the lifecycle and context of coroutines. Structured concurrency ensures coroutines are canceled when their parent scope ends.
7 |
8 | **GlobalScope**:
9 | - **Use Case**: Launches coroutines outside any lifecycle (e.g., background tasks that outlive an Activity).
10 | - **Caution**: Avoid in Android apps (manual cancellation required; risk of memory leaks).
11 | - **Example**:
12 | ```kotlin
13 | GlobalScope.launch {
14 | delay(1000L)
15 | println("GlobalScope: Not tied to lifecycle")
16 | }
17 | ```
18 | **runBlocking**:
19 | - **Use Case**: Blocks the current thread until coroutines finish (used in `main()` or tests).
20 | - **Example**:
21 | ```kotlin
22 | fun main() = runBlocking {
23 | launch {
24 | delay(500L)
25 | println("runBlocking: Main thread waits")
26 | }
27 | }
28 | ```
29 |
30 | **lifecycleScope (Android)**:
31 | - **Use Case**: Tied to an Activity/Fragment lifecycle. Auto-canceled when destroyed.
32 | - **Why It Matters**: Prevents memory leaks (no manual cancellation needed).
33 | - **Example**:
34 | ```kotlin
35 | class MyActivity : AppCompatActivity() {
36 | override fun onCreate(savedInstanceState: Bundle?) {
37 | lifecycleScope.launch {
38 | fetchData() // Auto-canceled when Activity is destroyed
39 | }
40 | }
41 | }
42 | ```
43 |
44 | **viewModelScope**:
45 | - **Use Case**: Tied to ViewModel lifecycle. Auto-canceled when ViewModel is cleared.
46 | - **Why It Matters**: Ensures lifecycle-safe operations (e.g., long-running tasks in ViewModels).
47 | - **Example**:
48 | ```kotlin
49 | class MyViewModel : ViewModel() {
50 | init {
51 | viewModelScope.launch {
52 | fetchData() // Auto-canceled when ViewModel is cleared
53 | }
54 | }
55 | }
56 | ```
57 |
58 | ---
59 |
60 | ### **2. `delay()` vs. `Thread.sleep()`**
61 | **`delay()`**:
62 | - **Behavior**: Suspends the coroutine without blocking the thread.
63 | - **Use Case**: Non-blocking delays (e.g., animations, timed UI updates).
64 | - **Example**:
65 | ```kotlin
66 | launch {
67 | delay(1000L)
68 | println("Non-blocking delay")
69 | }
70 | ```
71 |
72 | **`Thread.sleep()`**:
73 | - **Behavior**: Blocks the entire thread (not coroutine-aware).
74 | - **Caution**: Avoid on the main thread (causes ANRs in Android).
75 |
76 | ---
77 |
78 | ### **3. Coroutine Cancellation When Main Thread Ends**
79 | **Problem**:
80 | Coroutines in `GlobalScope` outlive the main thread unless explicitly canceled.
81 |
82 | **Solution with `runBlocking`**:
83 | ```kotlin
84 | fun main() = runBlocking {
85 | launch {
86 | delay(1000L)
87 | println("runBlocking ensures this runs")
88 | }
89 | delay(1500L) // Keep scope alive
90 | }
91 | ```
92 | **Why It Works**: `runBlocking` keeps the main thread alive until all child coroutines finish.
93 |
94 | ---
95 |
96 | ### **4. `runBlocking` Explained**
97 | **Purpose**:
98 | Bridges blocking and suspending code. Blocks the thread until all child coroutines finish.
99 |
100 | **Example**:
101 | ```kotlin
102 | fun main() = runBlocking {
103 | launch(Dispatchers.IO) {
104 | // Background task
105 | println("IO Dispatcher: ${Thread.currentThread().name}")
106 | }
107 | println("Main thread blocked until child completes")
108 | }
109 | ```
110 | **Why It Matters**: Essential for testing or blocking the main thread until async work completes.
111 |
112 | ---
113 |
114 | ### **5. `launch(Dispatchers.IO)` in `runBlocking`**
115 | **`Dispatchers.IO`**:
116 | - **Use Case**: For blocking IO tasks (e.g., disk/network).
117 | - **Example**:
118 | ```kotlin
119 | launch(Dispatchers.IO) {
120 | val result = fetchDataFromNetwork()
121 | println("Result: $result")
122 | }
123 | ```
124 | **Why It Matters**: Prevents blocking the main thread (critical for Android UI responsiveness).
125 |
126 | ---
127 |
128 | ### **6. Job, withTimeout, and Cancellation**
129 | **`Job` Interface**:
130 | - **Function**: Manages coroutine lifecycle (cancel, join).
131 | - **Example**:
132 | ```kotlin
133 | val job = launch {
134 | repeat(1000) { i ->
135 | println("Job: $i")
136 | delay(500L)
137 | }
138 | }
139 | job.cancel() // Cancel after 1.2s
140 | ```
141 |
142 | **`withTimeout`**:
143 | - **Use Case**: Cancels coroutines exceeding a time limit.
144 | - **Example**:
145 | ```kotlin
146 | withTimeout(1300L) {
147 | repeat(1000) {
148 | delay(400L)
149 | println("This repeats until timeout")
150 | }
151 | }
152 | ```
153 |
154 | ---
155 |
156 | ### **7. `async/await` for Concurrent Tasks**
157 | **`async`**:
158 | - **Use Case**: Runs tasks concurrently and returns a result.
159 | - **Example**:
160 | ```kotlin
161 | val result1 = async { fetchUser() }
162 | val result2 = async { fetchOrders() }
163 | println("Combined Result: ${result1.await()} + ${result2.await()}")
164 | ```
165 | **Why It Matters**: Efficiently combines results from multiple network/API calls.
166 |
167 | ---
168 |
169 | ### **8. `lifecycleScope` & `viewModelScope` in Android**
170 | **`lifecycleScope`**:
171 | - **Use Case**: Tied to Activity/Fragment lifecycle. Auto-canceled when destroyed.
172 | - **Example**:
173 | ```kotlin
174 | lifecycleScope.launch {
175 | val data = fetchData()
176 | updateUI(data)
177 | }
178 | ```
179 |
180 | **`viewModelScope`**:
181 | - **Use Case**: Tied to ViewModel lifecycle. Auto-canceled when cleared.
182 | - **Example**:
183 | ```kotlin
184 | viewModelScope.launch {
185 | val result = processInBackground()
186 | _uiState.value = result
187 | }
188 | ```
189 |
190 | ---
191 |
192 | ### **Best Practices**
193 | 1. **Avoid `GlobalScope`**: Use lifecycle-aware scopes to prevent memory leaks.
194 | 2. **Use Appropriate Dispatchers**:
195 | - `Dispatchers.Main` for UI updates.
196 | - `Dispatchers.IO` for disk/network.
197 | - `Dispatchers.Default` for CPU-intensive tasks.
198 | 3. **Cancel Coroutines Explicitly**: Cancel jobs when no longer needed.
199 | 4. **Handle Exceptions**: Use `try/catch` with `async` or `CoroutineExceptionHandler`.
200 |
201 | ---
202 |
203 | ### **Common Pitfalls**
204 | - **Blocking the Main Thread**: Never use `Thread.sleep()` or long sync tasks on the main thread.
205 | - **Ignoring Cancellation**: Failing to cancel coroutines leads to memory leaks.
206 | - **Misusing Dispatchers**: Using `Dispatchers.Main` for IO tasks causes ANRs.
207 |
208 | ---
209 |
210 | ### **Conclusion**
211 | Kotlin Coroutines streamline asynchronous programming with structured concurrency. For Android, prioritize `lifecycleScope` and `viewModelScope` to ensure lifecycle safety. By mastering scopes, dispatchers, and cancellation, you can build responsive, efficient apps while avoiding common pitfalls.
--------------------------------------------------------------------------------
/Android/Kotlin/Flows/flows.md:
--------------------------------------------------------------------------------
1 | # Kotlin Flows
2 |
3 | Kotlin Flows are a part of Kotlin Coroutines and provide a way to handle streams of asynchronous data.
4 |
5 | ## Key Concepts
6 |
7 | - **Flow**: Represents a cold asynchronous stream of values.
8 | - **Cold Stream**: The flow does not emit data until it is collected.
9 | - **Operators**: Functions like `map`, `filter`, `take`, etc., to transform flows.
10 | - **Collector**: Consumes the values emitted by the flow.
11 |
12 | ## Basic Example
13 |
14 | ```kotlin
15 | import kotlinx.coroutines.flow.*
16 | import kotlinx.coroutines.runBlocking
17 |
18 | fun simpleFlow(): Flow = flow {
19 | for (i in 1..3) {
20 | emit(i)
21 | }
22 | }
23 |
24 | fun main() = runBlocking {
25 | simpleFlow().collect { value ->
26 | println(value)
27 | }
28 | }
29 | ```
30 |
31 | ## Common Operators
32 |
33 | - `map { }` – Transform each value.
34 | - `filter { }` – Filter values.
35 | - `take(n)` – Take first n values.
36 | - `collect { }` – Terminal operator to receive values.
37 |
38 | ## Use Cases
39 |
40 | - Asynchronous data streams (e.g., network responses, database updates)
41 | - Reactive UI updates
42 | - Event handling
43 |
44 | ## Common Interview Questions on Kotlin Flows (with Answers)
45 |
46 | 1. **What is the difference between Flow and LiveData?**
47 | *Flow is a cold asynchronous stream from Kotlin Coroutines, suitable for both UI and non-UI layers, and supports operators and backpressure. LiveData is lifecycle-aware, designed for UI, and does not support operators or backpressure.*
48 |
49 | 2. **How does Flow handle backpressure?**
50 | *Flow is cold and suspends the producer if the consumer is slow, naturally handling backpressure by suspending emission until the collector is ready.*
51 |
52 | 3. **Explain cold vs hot streams in the context of Flow.**
53 | *Cold streams (like Flow) start emitting values only when collected, and each collector gets its own emissions. Hot streams (like SharedFlow, StateFlow) emit values regardless of collectors, and multiple collectors share emissions.*
54 |
55 | 4. **What are some common Flow operators and their use cases?**
56 | *Operators like `map`, `filter`, `take`, `flatMapConcat`, and `debounce` are used to transform, filter, limit, combine, or debounce emissions from a Flow.*
57 |
58 | 5. **How do you handle exceptions in a Flow?**
59 | *Use the `catch` operator to handle exceptions upstream, or try-catch blocks inside the flow builder for emission errors.*
60 |
61 | 6. **What is the difference between `flow`, `channelFlow`, and `stateFlow`?**
62 | - `flow`: Basic cold stream builder.
63 | - `channelFlow`: Allows concurrent emissions from multiple coroutines.
64 | - `stateFlow`: Hot, state-holder observable flow, always has a current value.
65 |
66 | 7. **How can you combine multiple flows?**
67 | *Use operators like `zip`, `combine`, or `flatMapMerge` to merge or combine emissions from multiple flows.*
68 |
69 | 8. **How does Flow cancellation work?**
70 | *Flow is cancellable; if the coroutine collecting the flow is cancelled, the flow stops emitting and cleans up resources.*
71 |
72 | 9. **What is the role of `collect` in Flow?**
73 | *`collect` is a terminal operator that triggers the flow to start emitting values and processes each emitted value.*
74 |
75 | 10. **How do you test Flows in unit tests?**
76 | *Use libraries like Turbine or run test coroutines with `runBlockingTest` to collect and assert emissions from a Flow.*
77 | ## Sample Code Interview Snippets (with Answers)
78 |
79 | ### 1. Collecting Flow Values
80 |
81 | **Question:** How do you collect values from a Flow and print them?
82 |
83 | ```kotlin
84 | val numbers = flowOf(1, 2, 3)
85 | numbers.collect { value ->
86 | println(value)
87 | }
88 | ```
89 | *This collects and prints each value emitted by the flow.*
90 |
91 | ---
92 |
93 | ### 2. Using Flow Operators
94 |
95 | **Question:** How do you use `map` and `filter` operators on a Flow?
96 |
97 | ```kotlin
98 | val flow = flowOf(1, 2, 3, 4, 5)
99 | flow
100 | .filter { it % 2 == 0 }
101 | .map { it * it }
102 | .collect { println(it) }
103 | ```
104 | *This filters even numbers and prints their squares.*
105 |
106 | ---
107 |
108 | ### 3. Exception Handling in Flows
109 |
110 | **Question:** How do you handle exceptions in a Flow?
111 |
112 | ```kotlin
113 | flow {
114 | emit(1)
115 | throw RuntimeException("Error!")
116 | }.catch { e ->
117 | emit(-1)
118 | }.collect { println(it) }
119 | ```
120 | *This emits 1, then catches the exception and emits -1.*
121 |
122 | ---
123 |
124 | ### 4. Combining Flows
125 |
126 | **Question:** How do you combine two flows?
127 |
128 | ```kotlin
129 | val flow1 = flowOf(1, 2)
130 | val flow2 = flowOf("A", "B")
131 | flow1.zip(flow2) { a, b -> "$a$b" }
132 | .collect { println(it) }
133 | ```
134 | *This combines emissions to print "1A" and "2B".*
135 |
136 | ---
137 |
138 | ### 5. Using StateFlow
139 |
140 | **Question:** How do you use StateFlow to hold and observe state?
141 |
142 | ```kotlin
143 | val stateFlow = MutableStateFlow(0)
144 | stateFlow.value = 5
145 | stateFlow.collect { println(it) }
146 | ```
147 | *This holds a state and emits updates to collectors.*
148 |
149 | ## Resources
150 |
151 | - [Kotlin Flow Documentation](https://kotlinlang.org/docs/flow.html)
152 | - [Coroutines Guide](https://kotlinlang.org/docs/coroutines-guide.html)
--------------------------------------------------------------------------------
/Android/Kotlin/cheetsheet.md:
--------------------------------------------------------------------------------
1 | # Cheetsheet
2 |
3 | ## First Kotlin program
4 | ```
5 | fun main() {
6 | println("Hello world")
7 | }
8 | ```
9 | ## Comments
10 | ```
11 | // This is an end-of-line comment
12 |
13 | /* This is a block comment
14 | on multiple lines. */
15 |
16 | /* The comment starts here
17 | /* contains a nested comment */
18 | and ends here. */
19 |
20 | KDoc
21 |
22 | /**
23 | * Calculates the sum of two integers.
24 | *
25 | * @param a The first integer to add.
26 | * @param b The second integer to add.
27 | * @return The sum of the two integers.
28 | */
29 | fun sum(a: Int, b: Int): Int {
30 | return a + b
31 | }
32 | ```
33 |
34 | ## Data types
35 | ```
36 | val booleanVar: Boolean = true
37 | val byteVar: Byte = 127
38 | val shortVar: Short = 32767
39 | val intVar: Int = 2147483647
40 | val longVar: Long = 9223372036854775807L
41 | val floatVar: Float = 3.14f
42 | val doubleVar: Double = 3.14159265358979323846
43 | val charVar: Char = 'A'
44 | val stringVar: String = "Hello, world!"
45 | ```
46 |
47 | ## Mutability
48 | ```
49 | var mutableString: String = "Adam"
50 | val immutableString: String = "Adam"
51 | val inferredString = "Adam"
52 | ```
53 |
54 | ## Numbers
55 | ```
56 | val intNum = 10
57 | val doubleNum = 10.0
58 | val longNum = 10L
59 | val floatNum = 10.0F
60 | ```
61 |
62 | ## Static Fields
63 | ```
64 | class Person {
65 | companion object {
66 | val NAME_KEY = "name_key"
67 | }
68 | }
69 |
70 | val key = Person.NAME_KEY
71 | ```
72 | ## Strings
73 | ```
74 | val name = "Adam"
75 | val greeting = "Hello, " + name
76 | val greetingTemplate = "Hello, $name"
77 | val interpolated = "Hello, ${name.toUpperCase()}"
78 | ```
79 | ## Booleans
80 | ```
81 | val trueBoolean = true
82 | val falseBoolean = false
83 | val andCondition = trueBoolean && falseBoolean
84 | val orCondition = trueBoolean || falseBoolean
85 | ```
86 | ## Ranges
87 | ```
88 | for(i in 0..3) {
89 | print(i)
90 | }
91 |
92 | for(i in 0 until 3) {
93 | print(i)
94 | }
95 |
96 | for(i in 2..8 step 2) {
97 | print(i)
98 | }
99 |
100 | for (i in 3 downTo 0) {
101 | print(i)
102 | }
103 |
104 | for (c in 'a'..'d') {
105 | print(c)
106 | }
107 | ```
108 | ## Null Safety
109 |
110 | ### Nullable properties
111 | ```
112 | val cannotBeNull: String = null // Invalid
113 | val canBeNull: String? = null // Valid
114 |
115 | val cannotBeNull: Int = null // Invalid
116 | val canBeNull: Int? = null // Valid
117 | ```
118 | ### Safe Operator
119 | ```
120 | val nullableStringLength: Int? = nullableString?.length
121 | val nullableDepartmentHead: String? = person?.department?.head?.name
122 | ```
123 | ### Checking for null
124 | ```
125 | val name: String? = "Adam"
126 |
127 | if (name != null && name.length > 0) {
128 | print("String length is ${name.length}")
129 | } else {
130 | print("String is empty.")
131 | }
132 | ```
133 | ### Elvis Operator
134 | ```
135 | val nonNullStringLength: Int = nullableString?.length ?: 0
136 | val nonNullDepartmentHead: String = person?.department?.head?.name ?: ""
137 | val nonNullDepartmentHead: String = person?.department?.head?.name.orEmpty()
138 | ```
139 | ### Safe Casts
140 | ```
141 | // Will not throw ClassCastException
142 | val nullableCar: Car? = (input as? Car)
143 | ```
144 | ## Collections
145 | ### Creation
146 | ```
147 | val numArray = arrayOf(1, 2, 3)
148 | val numList = listOf(1, 2, 3)
149 | val mutableNumList = mutableListOf(1, 2, 3)
150 | ```
151 | ### Accessing
152 | ```
153 | val firstItem = numList[0]
154 | val firstItem = numList.first()
155 | val firstItem = numList.firstOrNull()
156 | ```
157 | ### Iterating
158 | ```
159 | for (item in myList) {
160 | print(item)
161 | }
162 |
163 | myList.forEach {
164 | print(it)
165 | }
166 |
167 | myList.forEachIndexed { index, item ->
168 | print("Item at $index is: $item")
169 | }
170 | ```
171 | ### Maps
172 | ```
173 | val faceCards = mutableMapOf("Jack" to 11, "Queen" to 12, "King" to 13)
174 | val jackValue = faceCards["Jack"] // 11
175 | faceCards["Ace"] = 1
176 | ```
177 | ### Mutability
178 | ```
179 | val immutableList = listOf(1, 2, 3)
180 | val mutableList = immutableList.toMutableList()
181 |
182 | val immutableMap = mapOf("Jack" to 11, "Queen" to 12, "King" to 13)
183 | val mutableMap = immutableMap.toMutableMap()
184 | ```
185 | ### Filtering & Searching
186 | ```
187 | val evenNumbers = numList.filter { it % 2 == 0 }
188 | val containsEven = numList.any { it % 2 == 0 }
189 | val containsNoEvens = numList.none { it % 2 == 0 }
190 | val containsNoEvens = numList.all { it % 2 == 1 }
191 | val firstEvenNumber: Int = numList.first { it % 2 == 0 }
192 | val firstEvenOrNull: Int? = numList.firstOrNull { it % 2 == 0 }
193 | val fullMenu = objList.map { "${it.name} - $${it.detail}" }
194 | ```
195 | ## Functions
196 | ### Parameters & Return Types
197 | ```
198 | fun printName() {
199 | print("Adam")
200 | }
201 |
202 | fun printName(person: Person) {
203 | print(person.name)
204 | }
205 |
206 | fun getGreeting(person: Person): String {
207 | return "Hello, ${person.name}"
208 | }
209 |
210 | fun getGreeting(person: Person): String = "Hello, ${person.name}"
211 | fun getGreeting(person: Person) = "Hello, ${person.name}"
212 | ```
213 | ### Default Parameters
214 | ```
215 | fun getGreeting(person: Person, intro: String = "Hello,"): String {
216 | return "$intro ${person.name}"
217 | }
218 |
219 | // Returns "Hello, Adam"
220 | val hello = getGreeting(Person("Adam"))
221 |
222 | // Returns "Welcome, Adam"
223 | val welcome = getGreeting(Person("Adam"), "Welcome,")
224 | ```
225 | ### Named Parameters
226 | ```
227 | class Person(val name: String = "", age: Int = 0)
228 |
229 | // All valid
230 | val person = Person()
231 | val person = Person("Adam", 100)
232 | val person = Person(name = "Adam", age = 100)
233 | val person = Person(age = 100)
234 | val person = Person(age = 100, name = "Adam")
235 | ```
236 | ### Higher Order Functions
237 | ```
238 | fun calculate(x: Int, y: Int, operation: (Int, Int) -> Int): Int {
239 | return operation(x, y)
240 | }
241 |
242 | fun sum(x: Int, y: Int) = x + y
243 | ```
244 | ### Lambda Expressions
245 | ```
246 | val sum = { a: Int, b: Int -> a + b }
247 |
248 | val square: (Int) -> Int = { it * it }
249 | ```
250 | ### Static Functions (Companion Object)
251 | ```
252 | class Fragment(val args: Bundle) {
253 | companion object {
254 | fun newInstance(args: Bundle): Fragment {
255 | return Fragment(args)
256 | }
257 | }
258 | }
259 |
260 | val fragment = Fragment.newInstance(args)
261 | ```
262 | ### Extension Functions
263 | ```
264 | fun Int.timesTwo(): Int {
265 | return this * 2
266 | }
267 |
268 | val four = 2.timesTwo()
269 | ```
270 | ### Variable number of arguments (varargs)
271 | ```
272 | Varargs is a feature that allows you to pass a variable number of arguments of the same type to a function.
273 | fun printNumbers(vararg numbers: Int) {
274 | for (number in numbers) {
275 | println(number)
276 | }
277 | }
278 |
279 | fun main() {
280 | printNumbers(1, 2, 3) // prints 1, 2, 3
281 | printNumbers(4, 5, 6, 7, 8) // prints 4, 5, 6, 7, 8
282 | }
283 | ```
284 | ### Infix notation
285 | ```
286 | Infix in Kotlin allows you to define functions that can be called using infix notation (i.e., without using parentheses and the dot notation).
287 | infix fun Int.times(str: String) = str.repeat(this)
288 |
289 | fun main() {
290 | val str = 5 times "Hello "
291 | println(str) // Output: "Hello Hello Hello Hello Hello "
292 | }
293 | ```
294 | ## Scope Functions
295 | ### let
296 | ```
297 | let takes the object as an argument and returns the result of the lambda expression.
298 | If you don’t need to modify the original object and just want to perform some operations on it and get a new value, let is a good choice.
299 | val message: String? = "Hello"
300 | message?.let {
301 | print(it.toUpperCase()) // Output: "HELLO"
302 | }
303 | ```
304 | ### run
305 | ```
306 | run takes the object as the context and returns the result of the lambda expression.
307 | On the other hand, if you need to modify the original object and get the modified object itself as the result, run is a better choice.
308 | val message: String? = "Hello"
309 | message?.run {
310 | print(this.toUpperCase()) // Output: "HELLO"
311 | }
312 | ```
313 | ### with
314 | ```
315 | with is a non-extension function that can access members of its argument concisely: you can omit the instance name when referring to its members.
316 | val person = Person("Ali", 24)
317 | val message = with(person) {
318 | "My name is $name and I'm $age years old."
319 | }
320 | ```
321 | ### apply
322 | ```
323 | val person = Person("Ali", 24)
324 | person.apply {
325 | name = "Ali"
326 | age = 24
327 | }
328 | ```
329 | ### also
330 | ```
331 | val message: String? = "Hello"
332 | message?.also {
333 | print(it.toUpperCase()) // Output: "HELLO"
334 | }
335 | ```
336 | ## Classes
337 | ### Primary Constructor
338 | ```
339 | class Person(val name: String, val age: Int)
340 | val adam = Person("Adam", 100)
341 | ```
342 | ### Secondary Constructors
343 | ```
344 | class Person(val name: String) {
345 | private var age: Int? = null
346 |
347 | constructor(name: String, age: Int) : this(name) {
348 | this.age = age
349 | }
350 | }
351 |
352 | // Above can be replaced with default params
353 | class Person(val name: String, val age: Int? = null)
354 | ```
355 | ### Inheritance & Implementation
356 | ```
357 | open class Vehicle
358 | class Car : Vehicle()
359 |
360 | interface Runner {
361 | fun run()
362 | }
363 |
364 | class Machine : Runner {
365 | override fun run() {
366 | // ...
367 | }
368 | }
369 | ```
370 | ## Control Flow
371 | ### If Statements
372 | ```
373 | if (someBoolean) {
374 | doThing()
375 | } else {
376 | doOtherThing()
377 | }
378 | ```
379 | ### For Loops
380 | ```
381 | for (i in 0..10) { } // 1 - 10
382 | for (i in 0 until 10) // 1 - 9
383 | (0..10).forEach { }
384 | for (i in 0 until 10 step 2) // 0, 2, 4, 6, 8
385 | ```
386 | ### When Statements
387 | ```
388 | when (direction) {
389 | NORTH -> {
390 | print("North")
391 | }
392 | SOUTH -> print("South")
393 | EAST, WEST -> print("East or West")
394 | "N/A" -> print("Unavailable")
395 | else -> print("Invalid Direction")
396 | }
397 | ```
398 | ### While Loops
399 | ```
400 | while (x > 0) {
401 | x--
402 | }
403 |
404 | do {
405 | x--
406 | } while (x > 0)
407 | ```
408 | ## Destructuring Declarations
409 | ### Objects & Lists
410 | ```
411 | val person = Person("Adam", 100)
412 | val (name, age) = person
413 |
414 | val pair = Pair(1, 2)
415 | val (first, second) = pair
416 |
417 | val coordinates = arrayOf(1, 2, 3)
418 | val (x, y, z) = coordinates
419 | ```
420 | ### ComponentN Functions
421 | ```
422 | class Person(val name: String, val age: Int) {
423 | operator fun component1(): String {
424 | return name
425 | }
426 |
427 | operator fun component2(): Int {
428 | return age
429 | }
430 | }
431 | ```
432 | ### Visibility Modifiers in Kotlin
433 |
434 | Kotlin provides four visibility modifiers for classes, objects, interfaces, constructors, functions, and properties:
435 |
436 | | Modifier | Description | Scope |
437 | |------------|-----------------------------------------------------------------------------|----------------------------------------|
438 | | `public` | Visible everywhere (default if not specified). | Any code can access |
439 | | `internal` | Visible within the same module. | Same module |
440 | | `protected`| Visible to the class and its subclasses. | Subclasses only (not top-level) |
441 | | `private` | Visible only within the file or class where it is declared. | Same file or class |
442 |
443 | #### Example
444 |
445 | ```kotlin
446 | class Example {
447 | private val privateValue = 1
448 | protected val protectedValue = 2
449 | internal val internalValue = 3
450 | public val publicValue = 4 // 'public' is the default
451 | }
452 | ```
453 |
454 | - `private`: Only accessible inside `Example`.
455 | - `protected`: Accessible in `Example` and its subclasses.
456 | - `internal`: Accessible anywhere in the same module.
457 | - `public`: Accessible everywhere.
458 |
459 | For top-level declarations (outside classes), `protected` is not allowed.
460 |
461 |
--------------------------------------------------------------------------------
/Android/Kotlin/kotlin.md:
--------------------------------------------------------------------------------
1 | # What is Kotlin?
2 |
3 | Kotlin is a modern, statically typed programming language developed by JetBrains. It runs on the Java Virtual Machine (JVM) and can also be compiled to JavaScript or native code. Kotlin is fully interoperable with Java, meaning you can use Kotlin and Java code together in the same project.
4 |
5 | ## Key Features of Kotlin
6 |
7 | - **Concise Syntax:** Reduces boilerplate code compared to Java.
8 | - **Null Safety:** Built-in null safety helps prevent null pointer exceptions.
9 | - **Extension Functions:** Allows you to extend existing classes with new functionality.
10 | - **Coroutines:** Simplifies asynchronous programming and concurrency.
11 | - **Smart Casts:** Automatically casts types when possible.
12 | - **Data Classes:** Simplifies the creation of classes for holding data.
13 | - **Interoperability:** 100% interoperable with Java libraries and frameworks.
14 |
15 | ## How is Kotlin Better Than Java?
16 |
17 | ### 1. **Conciseness**
18 | Kotlin code is more concise and expressive. For example, data classes, type inference, and default arguments reduce the amount of code you need to write.
19 |
20 | **Java:**
21 | ```java
22 | public class User {
23 | private String name;
24 | private int age;
25 | // getters, setters, constructor, toString, equals, hashCode
26 | }
27 | ```
28 | **Kotlin:**
29 | ```kotlin
30 | data class User(val name: String, val age: Int)
31 | ```
32 |
33 | ### 2. **Null Safety**
34 | Kotlin's type system distinguishes between nullable and non-nullable types, reducing the risk of null pointer exceptions.
35 |
36 | **Java:**
37 | ```java
38 | String name = null; // Possible NullPointerException
39 | ```
40 | **Kotlin:**
41 | ```kotlin
42 | var name: String? = null // Compiler enforces null checks
43 | ```
44 |
45 | ### 3. **Coroutines for Asynchronous Programming**
46 | Kotlin provides coroutines for easy and efficient asynchronous programming, making code easier to read and maintain.
47 |
48 | ### 4. **Extension Functions**
49 | You can add new functions to existing classes without modifying their source code.
50 |
51 | **Kotlin:**
52 | ```kotlin
53 | fun String.isEmail(): Boolean { /* ... */ }
54 | ```
55 |
56 | ### 5. **Smart Casts**
57 | Kotlin automatically casts types when it is safe to do so, reducing the need for explicit casting.
58 |
59 | ### 6. **Interoperability**
60 | Kotlin can use all existing Java libraries and frameworks, making migration easy.
61 |
62 | ### 7. **Modern Language Features**
63 | Kotlin supports features like lambda expressions, higher-order functions, destructuring declarations, and more, which make it more expressive and powerful.
64 |
65 | ## Conclusion
66 |
67 | Kotlin offers a more modern, concise, and safer alternative to Java, especially for Android development. Its features help developers write cleaner, more reliable, and maintainable code.
68 |
--------------------------------------------------------------------------------
/Android/Libs/libs.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Libs/libs.md
--------------------------------------------------------------------------------
/Android/Performance Optimazation/performance.md:
--------------------------------------------------------------------------------
1 | # Android App Performance Optimization: Common Interview Questions & Answers
2 |
3 | ## 1. What are the key areas to focus on for Android app performance optimization?
4 | **Answer:**
5 | - Memory usage (avoid leaks, use efficient data structures)
6 | - UI rendering (smooth scrolling, avoid overdraw)
7 | - Network calls (batch requests, use caching)
8 | - Battery consumption (optimize background tasks, use JobScheduler/WorkManager)
9 | - App startup time (lazy loading, minimize onCreate work)
10 |
11 | ## 2. How do you detect and fix memory leaks in Android?
12 | **Answer:**
13 | - Use tools like Android Profiler, LeakCanary
14 | - Avoid holding references to Context in static fields
15 | - Unregister listeners and callbacks
16 | - Use WeakReference where appropriate
17 |
18 | ## 3. What is overdraw and how can you reduce it?
19 | **Answer:**
20 | - Overdraw happens when the same pixel is drawn multiple times in a single frame
21 | - Use the "Show GPU Overdraw" tool in Developer Options
22 | - Flatten view hierarchies, use background only where needed, avoid unnecessary nesting
23 |
24 | ## 4. How can you optimize RecyclerView performance?
25 | **Answer:**
26 | - Use ViewHolder pattern
27 | - Use DiffUtil for list updates
28 | - Set fixed size if possible (`setHasFixedSize(true)`)
29 | - Use appropriate layout managers
30 |
31 | ## 5. How do you improve app startup time?
32 | **Answer:**
33 | - Defer heavy initialization (lazy loading)
34 | - Use SplashScreen API for smoother transitions
35 | - Avoid blocking the main thread in `onCreate()`
36 | - Use background threads for non-UI work
37 |
38 | ## 6. How do you optimize network usage in Android apps?
39 | **Answer:**
40 | - Use efficient data formats (e.g., JSON over XML)
41 | - Implement caching (OkHttp, Retrofit)
42 | - Compress data before sending
43 | - Batch network requests when possible
44 |
45 | ## 7. What tools do you use for profiling and monitoring app performance?
46 | **Answer:**
47 | - Android Profiler (CPU, Memory, Network)
48 | - Systrace
49 | - LeakCanary
50 | - StrictMode
51 | - Firebase Performance Monitoring
52 |
53 | ## 8. How do you minimize battery drain in your app?
54 | **Answer:**
55 | - Schedule background tasks efficiently (WorkManager, JobScheduler)
56 | - Use location updates wisely (set appropriate intervals)
57 | - Avoid wake locks unless necessary
58 | - Batch operations to minimize wakeups
59 |
60 | ## 9. What is StrictMode and how does it help?
61 | **Answer:**
62 | - StrictMode is a developer tool to catch accidental disk/network access on the main thread and memory leaks
63 | - Helps identify and fix performance bottlenecks during development
64 |
65 | ## 10. How do you handle large images efficiently in Android?
66 | **Answer:**
67 | - Use libraries like Glide or Picasso for image loading and caching
68 | - Downsample images to required size
69 | - Use Bitmap recycling and avoid loading full-size images into memory
70 |
71 | ## 11. How do you optimize database operations in Android?
72 | **Answer:**
73 | - Use indexing and optimized queries
74 | - Prefer asynchronous operations (Room with coroutines/RxJava)
75 | - Use transactions for batch operations
76 | - Minimize main thread database access
77 |
78 | ## 12. How do you profile and optimize rendering performance in complex UI screens?
79 | **Answer:**
80 | - Use Layout Inspector and Profile GPU Rendering tools
81 | - Minimize nested layouts and use ConstraintLayout
82 | - Reuse views and avoid unnecessary view invalidations
83 | - Optimize custom views and drawing code
84 |
85 | ## 13. What strategies do you use for efficient background processing?
86 | **Answer:**
87 | - Use WorkManager for deferrable, guaranteed background work
88 | - Use foreground services only when necessary
89 | - Schedule tasks based on device state (charging, network)
90 | - Cancel unnecessary or duplicate tasks
91 |
92 | ## 14. How do you ensure smooth scrolling in lists with images or complex items?
93 | **Answer:**
94 | - Use image loading libraries with placeholders and caching
95 | - Preload data and images when possible
96 | - Avoid heavy computations in `onBindViewHolder`
97 | - Use RecyclerView’s built-in optimizations
98 |
99 | ## 15. How do you monitor and improve ANR (Application Not Responding) rates?
100 | **Answer:**
101 | - Analyze ANR traces from Play Console or logcat
102 | - Move heavy operations off the main thread
103 | - Optimize broadcast receivers and content providers
104 | - Use watchdogs and timeouts for long-running tasks
105 |
106 |
107 | ## 16. How do you optimize APK size in Android apps?
108 | **Answer:**
109 | - Remove unused resources and code (ProGuard/R8)
110 | - Use Android App Bundles for dynamic delivery
111 | - Compress images and assets
112 | - Avoid unnecessary libraries and dependencies
113 | - Use vector drawables where possible
114 |
115 | ## 17. What are best practices for thread management in Android?
116 | **Answer:**
117 | - Use Executors, HandlerThread, or coroutines for background work
118 | - Avoid creating excessive threads
119 | - Clean up threads and tasks to prevent leaks
120 | - Use main thread only for UI updates
121 |
122 | ## 18. How do you ensure security without compromising performance?
123 | **Answer:**
124 | - Use encrypted storage efficiently (e.g., EncryptedSharedPreferences)
125 | - Minimize cryptographic operations on the main thread
126 | - Use network security configuration for secure connections
127 | - Avoid storing sensitive data in memory longer than needed
128 |
129 | ## 19. How do you handle configuration changes efficiently?
130 | **Answer:**
131 | - Use ViewModel to retain UI data
132 | - Save and restore state using onSaveInstanceState
133 | - Use resource qualifiers for layouts and assets
134 | - Avoid heavy operations in Activity recreation
135 |
136 | ## 20. How do you test app performance across different devices?
137 | **Answer:**
138 | - Use Firebase Test Lab or physical device farms
139 | - Test on a range of API levels and hardware specs
140 | - Automate performance tests with Espresso or UI Automator
141 | - Monitor real-world performance with analytics and crash reporting tools
142 |
--------------------------------------------------------------------------------
/Android/Playstore/playstore.md:
--------------------------------------------------------------------------------
1 | # Play Store Related Interview Questions (with Console Focus)
2 |
3 | ## General Play Store Questions
4 |
5 | ### 1. What is the Google Play Console?
6 | The Google Play Console is a web-based platform provided by Google for Android developers to manage, publish, and monitor their apps on the Google Play Store. It offers tools for app release, analytics, user feedback, and policy compliance.
7 |
8 | ### 2. How do you publish an app on the Play Store?
9 | To publish an app:
10 | 1. Create a developer account on the Play Console.
11 | 2. Prepare your app (APK/AAB, assets, metadata).
12 | 3. Create a new app in the Play Console.
13 | 4. Fill in the store listing details.
14 | 5. Upload the APK/AAB.
15 | 6. Set content rating, pricing, and distribution.
16 | 7. Review and submit for review.
17 |
18 | ### 3. What are the steps involved in releasing an update?
19 | - Increment the app version code and name.
20 | - Build and sign the new APK/AAB.
21 | - Upload the new build to the Play Console.
22 | - Fill in the release notes.
23 | - Select the release track (internal, alpha, beta, production).
24 | - Review and roll out the update.
25 |
26 | ### 4. What are the requirements for uploading an APK/AAB?
27 | - Must be signed with a valid key.
28 | - Meet Play Store policies and guidelines.
29 | - Target a supported API level.
30 | - File size within Play Store limits.
31 | - Pass pre-launch checks.
32 |
33 | ### 5. What is the difference between APK and AAB?
34 | - APK (Android Package): The traditional Android app package distributed to users.
35 | - AAB (Android App Bundle): A publishing format that allows Google Play to generate optimized APKs for different device configurations, reducing app size.
36 |
37 | ### 6. How do you manage app signing in Play Console?
38 | You can use Play App Signing, where Google manages your app signing key securely. You upload an unsigned APK/AAB, and Google signs it before distributing to users.
39 |
40 | ### 7. What is the review process for apps on the Play Store?
41 | After submission, Google reviews the app for policy compliance, security, and content. The process can take a few hours to several days. You receive feedback or approval via the Play Console.
42 |
43 | ### 8. How do you handle app versioning?
44 | Update the `versionCode` and `versionName` in your app’s manifest or build configuration for each release. The Play Store uses `versionCode` to distinguish updates.
45 |
46 | ### 9. What are the Play Store policies developers must follow?
47 | Developers must adhere to content, privacy, security, and monetization policies outlined by Google. Violations can result in app suspension or removal.
48 |
49 | ---
50 |
51 | ## Console-Specific Questions
52 |
53 | ### 1. How do you use the Play Console to track app performance?
54 | Use the "Statistics" and "Android Vitals" sections to monitor installs, uninstalls, ratings, crashes, ANRs, and other performance metrics.
55 |
56 | ### 2. What analytics and reports are available in the Play Console?
57 | Reports include user acquisition, retention, crash reports, ANRs, revenue, ratings, reviews, and pre-launch reports.
58 |
59 | ### 3. How do you manage testers and beta releases?
60 | Create closed or open testing tracks, invite testers via email or link, and release builds to these tracks for feedback before production rollout.
61 |
62 | ### 4. What is staged rollout and how is it configured?
63 | Staged rollout allows you to release an update to a percentage of users. In the release settings, specify the rollout percentage and monitor feedback before expanding.
64 |
65 | ### 5. How do you handle crashes and ANRs using Play Console?
66 | Use the "Android Vitals" section to view crash and ANR reports, stack traces, and affected devices. Use this data to diagnose and fix issues.
67 |
68 | ### 6. How do you manage in-app products and subscriptions?
69 | Set up in-app products and subscriptions under the "Monetize" section. Define product IDs, pricing, and descriptions, and integrate billing in your app.
70 |
71 | ### 7. How do you set up and manage store listing experiments?
72 | Use the "Store Listing Experiments" feature to A/B test different versions of your app’s store listing (icons, descriptions, screenshots) and analyze which performs better.
73 |
74 | ### 8. What is the Pre-launch report and how do you use it?
75 | The Pre-launch report runs your app on real devices in Google’s test lab, identifying crashes, performance issues, and security vulnerabilities before release.
76 |
77 | ### 9. How do you respond to user reviews via the Play Console?
78 | Go to the "Reviews" section, read user feedback, and reply directly to users to address concerns or thank them for feedback.
79 |
80 | ### 10. How do you use the Play Console for app localization?
81 | Use the "Store Presence" section to add translations for your app’s store listing, making your app accessible to users in different languages.
82 |
83 | ---
84 |
85 | ## Advanced/Scenario-Based
86 |
87 | ### 1. How do you roll back a faulty release?
88 | If a release causes issues, halt the rollout or deactivate the release in the Play Console. Then, upload and release a previous stable version with a higher version code.
89 |
90 | ### 2. How do you handle app suspension or policy violations?
91 | Review the violation notice in the Play Console, address the issues, update your app to comply with policies, and submit an appeal or a new version for review.
92 |
93 | ### 3. How do you use Play Console to manage multiple tracks (internal, alpha, beta, production)?
94 | Create separate release tracks for internal testing, closed/open beta, and production. Upload different builds to each track for controlled testing and staged releases.
95 |
96 | ### 4. How do you monitor and improve app vitals?
97 | Regularly check the "Android Vitals" dashboard for crash rates, ANRs, battery usage, and other metrics. Address issues promptly to maintain app quality.
98 |
99 | ### 5. How do you use Play Console for device exclusion or targeting?
100 | In the "Device Catalog," review supported devices and exclude devices with known issues or target specific device features to optimize app availability.
101 |
102 | ---
103 |
104 | *Tip: Be ready to demonstrate knowledge of the Play Console UI and its features.*
--------------------------------------------------------------------------------
/Android/RX Java/rx.md:
--------------------------------------------------------------------------------
1 | ### What is RxAndroid, RxJava, and RxKotlin?
2 |
3 | - **RxJava** is a Java library for composing asynchronous and event-based programs using observable sequences. It provides the core reactive programming API for Java.
4 |
5 | - **RxAndroid** is a lightweight wrapper around RxJava that adds Android-specific bindings. It provides Android schedulers (like `AndroidSchedulers.mainThread()`) to easily work with UI threads.
6 |
7 | - **RxKotlin** is a Kotlin extension for RxJava, offering more idiomatic Kotlin APIs and utilities to make reactive programming easier and more concise in Kotlin.
8 |
9 | These libraries are often used together in Android development to handle asynchronous operations, threading, and event-based programming in a clean and maintainable way.
10 | 1. **What is RxJava?**
11 | RxJava is a Java implementation of Reactive Extensions, a library for composing asynchronous and event-based programs using observable sequences.
12 |
13 | 2. **What are Observables in RxJava?**
14 | Observables are the core data type in RxJava. They emit items or events to which observers can subscribe.
15 |
16 | 3. **What is an Observer?**
17 | An Observer subscribes to an Observable to receive emitted items or events.
18 |
19 | 4. **What is a Subscriber?**
20 | A Subscriber is a type of Observer with additional methods for managing the subscription, such as `unsubscribe()`.
21 |
22 | 5. **What is the difference between Observable and Flowable?**
23 | Observable is used for streams with a small or manageable number of items. Flowable is used for handling large or infinite streams with backpressure support.
24 |
25 | 6. **What is Backpressure?**
26 | Backpressure is a mechanism to handle situations where an Observable emits items faster than an Observer can consume them.
27 |
28 | 7. **What are Schedulers in RxJava?**
29 | Schedulers control the threads on which Observables emit items and Observers consume them (e.g., IO, computation, main thread).
30 |
31 | 8. **How do you create an Observable?**
32 | Using methods like `Observable.just()`, `Observable.fromIterable()`, or `Observable.create()`.
33 |
34 | 9. **What is the use of the `map()` operator?**
35 | The `map()` operator transforms each emitted item by applying a function to it.
36 |
37 | 10. **What is the use of the `flatMap()` operator?**
38 | `flatMap()` transforms each item into an Observable and then flattens the emissions into a single Observable.
39 |
40 | 11. **What is the difference between `map()` and `flatMap()`?**
41 | `map()` transforms items one-to-one, while `flatMap()` can transform one item into multiple items or Observables.
42 |
43 | 12. **What is a Subject in RxJava?**
44 | A Subject is both an Observable and an Observer. It can emit new items to its subscribers and subscribe to other Observables.
45 |
46 | 13. **What are the types of Subjects?**
47 | Common types include `PublishSubject`, `BehaviorSubject`, `ReplaySubject`, and `AsyncSubject`.
48 |
49 | 14. **What is a CompositeDisposable?**
50 | CompositeDisposable is a container that can hold multiple Disposables and dispose of them all at once.
51 |
52 | 15. **How do you handle errors in RxJava?**
53 | By using operators like `onErrorReturn()`, `onErrorResumeNext()`, or handling errors in the Observer’s `onError()` method.
54 |
55 | 16. **What is the difference between `observeOn()` and `subscribeOn()`?**
56 | `subscribeOn()` specifies the thread for the Observable to operate on, while `observeOn()` specifies the thread for the Observer.
57 |
58 | 17. **What is the use of the `filter()` operator?**
59 | `filter()` emits only those items from an Observable that pass a predicate test.
60 |
61 | 18. **How do you combine multiple Observables?**
62 | Using operators like `merge()`, `concat()`, `zip()`, and `combineLatest()`.
63 |
64 | 19. **What is the use of the `debounce()` operator?**
65 | `debounce()` emits an item from an Observable only after a particular timespan has passed without another emission.
66 |
67 | 20. **How do you test RxJava code?**
68 | By using `TestObserver`, `TestSubscriber`, and controlling Schedulers with `TestScheduler`.
69 |
70 | Let me know if you need answers for more questions!
71 |
--------------------------------------------------------------------------------
/Android/UX/ux.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/UX/ux.md
--------------------------------------------------------------------------------
/Android/Ui/ui.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Android/Ui/ui.md
--------------------------------------------------------------------------------
/Assets/devcrack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Assets/devcrack.png
--------------------------------------------------------------------------------
/Assets/devcrack2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Assets/devcrack2.png
--------------------------------------------------------------------------------
/Backend Basics/APIs/apis.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Backend Basics/APIs/apis.md
--------------------------------------------------------------------------------
/Backend Basics/Firebase/firebase.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Backend Basics/Firebase/firebase.md
--------------------------------------------------------------------------------
/Backend Basics/GraphQL/graph.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Backend Basics/GraphQL/graph.md
--------------------------------------------------------------------------------
/Backend Basics/REST/rest.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Backend Basics/REST/rest.md
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # 🙌 Contributing to Mobile Dev Interview Prep
2 |
3 | Thank you for considering contributing to this open-source interview question bank for mobile developers! Your contributions will help many developers prepare for interviews and stay up-to-date with modern mobile technologies.
4 |
5 | ---
6 |
7 | ## 📌 How You Can Contribute
8 |
9 | 1. **Add New Interview Questions/Answers**
10 | - Choose the appropriate platform folder (`android`, `ios`, `flutter`, `kmm`, etc.).
11 | - Create or edit a Markdown file and use the standard format below.
12 | - Add clear, concise questions with relevant and well-explained answers.
13 |
14 | 2. **Improve Existing Content**
15 | - Fix typos, improve clarity, add examples or links to documentation/blogs.
16 |
17 | 3. **Share Real Interview Experiences**
18 | - Share anonymized questions you've been asked in interviews (especially company-specific ones).
19 |
20 | 4. **Suggest Enhancements**
21 | - Help improve structure, naming conventions, or tooling for contributors.
22 |
23 | ---
24 |
25 | ## 🧾 Content Format (Markdown)
26 |
27 | Please use the following format when adding content:
28 |
29 | ```markdown
30 | ### Q: What is a State Hoisting in Jetpack Compose?
31 |
32 | **A:**
33 | State hoisting is a pattern in Jetpack Compose where the state is moved to a composable's caller instead of being held internally. This improves reusability and testability of the composable.
34 |
35 | 📌 **Keywords:** Jetpack Compose, State, Hoisting
36 |
--------------------------------------------------------------------------------
/Cross Platform/Flutter/flutter.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Cross Platform/Flutter/flutter.md
--------------------------------------------------------------------------------
/Cross Platform/KMM/kmm.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Cross Platform/KMM/kmm.md
--------------------------------------------------------------------------------
/Cross Platform/React Native/react.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Cross Platform/React Native/react.md
--------------------------------------------------------------------------------
/Design Patterns/design.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Design Patterns/design.md
--------------------------------------------------------------------------------
/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Issue Report
3 | about: Report a bug or suggest an improvement
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 | ---
8 |
9 | **Describe the issue**
10 | A clear and concise description of what the issue is.
11 |
12 | **Steps to reproduce**
13 | Steps to reproduce the behavior:
14 | 1. Go to '...'
15 | 2. Click on '....'
16 | 3. See error
17 |
18 | **Expected behavior**
19 | Describe what you expected to happen.
20 |
21 | **Screenshots**
22 | If applicable, add screenshots to help explain your problem.
23 |
24 | **Environment**
25 | - OS: [e.g. macOS, Windows]
26 | - Browser (if applicable): [e.g. Chrome, Safari]
27 | - Version: [e.g. v1.0.0]
28 |
29 | **Additional context**
30 | Add any other context about the problem here.
31 |
--------------------------------------------------------------------------------
/Interviews/interview.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Interviews/interview.md
--------------------------------------------------------------------------------
/License.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 [Prasad.Vennam]
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Pull Request
3 | about: Propose changes to improve the project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 | ---
8 |
9 | **Description**
10 |
11 | Please include a summary of the changes and the related issue.
12 |
13 | **Type of change**
14 |
15 | - [ ] Bug fix
16 | - [ ] New feature
17 | - [ ] Documentation update
18 | - [ ] Other (please describe):
19 |
20 | **Checklist**
21 |
22 | - [ ] My code follows the repository’s style guidelines
23 | - [ ] I have performed a self-review of my own code
24 | - [ ] I have commented my code, particularly in hard-to-understand areas
25 | - [ ] I have made corresponding changes to the documentation
26 | - [ ] My changes generate no new warnings or errors
27 | - [ ] I have added tests if applicable
28 |
29 | **Related issue**
30 |
31 | Fixes # (issue number)
32 |
33 | **Additional Notes**
34 |
35 | Add any other context or screenshots about the pull request here.
36 |
--------------------------------------------------------------------------------
/ReadMe.md:
--------------------------------------------------------------------------------
1 | # 📱 DevCrack: Mobile Interview Preparation
2 | 
3 |
4 | A community-driven open-source repository to help mobile developers prepare for technical interviews. Covers Android, iOS, Flutter, KMM, system design, testing, architecture, and more!
5 |
6 | [](https://opensource.org/licenses/MIT)
7 | 
8 | 
9 | 
10 | 
11 | [](https://github.com/vennamprasad/DevCrack-Mobile-Interviews/pulls)
12 |
13 |
14 | ## ✍️ Contributing
15 |
16 | 1. Fork the repo.
17 | 2. Create a folder or file in the appropriate section.
18 | 3. Add questions/answers in `Markdown`.
19 | 4. Submit a Pull Request.
20 |
21 | See [CONTRIBUTING.md](./CONTRIBUTING.md) for more.
22 |
23 | ## 📝 License
24 |
25 | [MIT License](./LICENSE)
26 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Reporting a Vulnerability
4 |
5 | If you discover a security vulnerability in this project, please report it responsibly by emailing **deepseek1247@gmail.com**
6 |
7 | Do NOT create a public issue for security vulnerabilities.
8 |
9 | We will respond within 48 hours and work with you to resolve the issue.
10 |
11 | ---
12 |
13 | ## Supported Versions
14 |
15 | Please specify the version of the project where you found the vulnerability.
16 |
17 | ---
18 |
19 | ## Security Best Practices
20 |
21 | - Keep your dependencies up to date
22 | - Do not share sensitive credentials in issues or pull requests
23 |
--------------------------------------------------------------------------------
/System Design for Mobile/system_design.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/System Design for Mobile/system_design.md
--------------------------------------------------------------------------------
/Testing/Espresso/espresso.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Testing/Espresso/espresso.md
--------------------------------------------------------------------------------
/Testing/JUnit/junit.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Testing/JUnit/junit.md
--------------------------------------------------------------------------------
/Testing/Mockito/mokito.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Testing/Mockito/mokito.md
--------------------------------------------------------------------------------
/Testing/UIAutomator/ui_automater.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Testing/UIAutomator/ui_automater.md
--------------------------------------------------------------------------------
/Tools/CI CD/ci_cd.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Tools/CI CD/ci_cd.md
--------------------------------------------------------------------------------
/Tools/CI CD/fatlate.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Tools/CI CD/fatlate.md
--------------------------------------------------------------------------------
/Tools/Charles/charles.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Tools/Charles/charles.md
--------------------------------------------------------------------------------
/Tools/Git/git.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Tools/Git/git.md
--------------------------------------------------------------------------------
/Tools/Postman/postman.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/Tools/Postman/postman.md
--------------------------------------------------------------------------------
/iOS/Swift/swift.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/iOS/Swift/swift.md
--------------------------------------------------------------------------------
/iOS/SwiftUI/swift_ui.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/iOS/SwiftUI/swift_ui.md
--------------------------------------------------------------------------------
/iOS/UIKit basics/ui_kit_basics.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vennamprasad/DevCrack-Mobile-Interviews/d10cc17b5d26cb085a15983cfefa2fb51bd0613d/iOS/UIKit basics/ui_kit_basics.md
--------------------------------------------------------------------------------