AceMobileInterview

Interview guides / android

Google-Style Android Interview Questions

Unofficial Google-style Android interview prep: Kotlin, coroutines, architecture, coding, and mobile system design.

Unofficial guidance. Team loops differ and AceMobileInterview is not affiliated with Google.

Strong candidates show Kotlin fluency, structured concurrency, clean architecture, and careful background-work choices under Android limits.

  1. 1.How do you keep work off the main thread and avoid ANRs?

    Move disk/network/CPU work to IO/Default dispatchers, never block Main, cancel with viewModelScope, and profile jank. Explain ANR traces and how you would reproduce with large payloads on the UI thread.

  2. 2.Design a news reader with offline cache on Android.

    UI → ViewModel → Repository → Retrofit + Room as SoT. Observe Flow from Room, pull-to-refresh, empty/loading/error states, and read-offline from cache. Skip full Paging 3 if timeboxed unless asked.

  3. 3.What causes ANRs, and how do you diagnose them?

    ANRs happen when the main thread is blocked (~5s for input). Avoid disk/network on Main; use coroutines. Diagnose with ANR traces, StrictMode, and Systrace/Perfetto. Mention BroadcastReceiver and Service timeouts too.

  4. 4.Security difference between implicit and explicit intents?

    Explicit targets a component. Implicit resolve by filters—risk of interception. Use explicit for internal navigation; validate incoming intent extras.

  5. 5.Why specify FLAG_IMMUTABLE/MUTABLE on PendingIntents?

    Required on modern APIs for security. Prefer IMMUTABLE unless you must update extras; prevents intent redirection attacks.

  6. 6.What are Entity, DAO, and Database in Room?

    Entity=table, DAO=queries, Database=holder. Use suspend/Flow queries; type converters carefully; migrations mandatory for schema changes.

  7. 7.What belongs in a ViewModel vs UI layer?

    UI state and business orchestration surviving rotation. No Android framework Views, no Context leaks (use Application context carefully). Expose immutable UI state flows.

  8. 8.How do you expose Retrofit APIs with suspend functions?

    suspend endpoints return body/Response; map errors via HttpException. Prefer repository layer; use Call adapters carefully.

  9. 9.How do UI test stacks differ?

    Espresso for Views; Compose testing APIs for semantics nodes. Prefer idling resources/synchronization; keep UI tests for critical paths.

  10. 10.Difference between remember and rememberSaveable?

    remember survives recomposition only. rememberSaveable also survives config change via saveable registry. Neither survives process death unless backed by SavedState.

  11. 11.When do you use an Activity vs a Fragment?

    Activity is a screen entry point/window host. Fragments compose reusable UI within an activity (tabs, master-detail). Prefer single-activity + navigation component for many modern apps.

  12. 12.When is ConstraintLayout still useful?

    Complex XML view hierarchies; Compose ConstraintLayout for similar relative positioning. Prefer simpler Column/Row when enough.

  13. 13.Determine if a string of brackets is valid. Implement in Kotlin and discuss complexity.

    Stack of opening brackets; on closing, check match. O(n) time, O(n) space. Cover odd length and early exit. Relates to parsing nested UI/token streams.

  14. 14.Implement binary search; return index or -1.

    Lo/hi mid carefully. Kotlin's Arrays.binarySearch exists—still implement manually in interviews.

  15. 15.Max profit with one buy and one sell over a price array.

    Track min so far and best profit. O(n). Clarify single transaction constraint.

  16. 16.Reverse a singly linked list iteratively in Kotlin.

    prev/curr/next walk. Discuss data class nodes vs mutable var next. O(n)/O(1).

Keep going with AceMobileInterview

Reading helps. Timed practice locks it in. Jump into the interactive track for algorithms with LeetCode links, studio projects, debugging zips, and mobile system design.

iOS trackAndroid trackMore guides