androidfaceinterview

repository·master·Indexed 21 days ago

https://github.com/ellen2018/androidfaceinterview

A comprehensive collection of interview questions for Android developers, serving as a study guide for candidates from intern to senior levels. The repository covers seven main modules: Java (fundamentals, collections, concurrency, JVM), Kotlin, Android internals (ABCS, Handler/Looper, IPC/Binder, View system, memory optimization), Mobile UI Frameworks (primarily Flutter), Data Structures and Algorithms, common open-source libraries (RxJava, OkHttp, Retrofit, Dagger2), and computer network knowledge.

Tokens
22.2K
Snippets
21
Records
143
Agent score
76%

What's inside androidfaceinterview

  1. Overview of Android Interview Question Set

    master

    This repository is a collection of interview questions designed for Android developers ranging from interns and junior engineers to intermediate and senior levels.

    Note: The repository provides the questions and learning links but does not provide direct answers. To find answers, users are encouraged to refer to the author's Android Knowledge System Summary or star the AndroidFace project.

    The question set is organized into 7 main modules:

    1. Java
    2. Kotlin
    3. Android
    4. Mobile UI Frameworks (primarily Flutter)
    5. Data Structures and Algorithms
    6. Common Open Source Libraries
    7. Computer Network Knowledge
  2. Common Android Database Libraries

    master

    This repository provides a curated list of common database libraries used in Android development for ORM (Object-Relational Mapping) and local data storage. The following libraries are recommended for study or implementation:

    1. GreenDao: A high-performance ORM for Android.
    2. LitePal: A lightweight ORM that simplifies database operations.
    3. OrmLite: A mature ORM library that supports both Android and Java SE.
    4. DBFlow: A powerful, fluent database library for Android.
    5. Realm: A mobile-first, object-oriented database designed for high performance.
  3. Understand Android screen adaptation concepts

    master

    Android screen adaptation involves managing different screen sizes and densities. Key topics for developers to master include:

    1. Screen Units: Understanding the differences between dp (density-independent pixels), sp (scale-independent pixels), px (pixels), and pt (points).
    2. Adaptation Strategies: Implementing practical experiences for handling various device configurations in a project.
    3. Advanced Adaptation Schemes: Studying lightweight adaptation solutions, such as the one used by Toutiao (今日头条), which involves intercepting resource loading to dynamically scale dimensions.
  4. Reference JVM technical topics

    master

    This document provides a collection of interview questions and external deep-dive links regarding the Java Virtual Machine (JVM).

    Key topics covered include:

    • Java code execution flow
    • Java memory structure and memory models
    • Garbage Collection (GC) mechanisms
    • Class loading processes and ClassLoaders
    • static keyword compilation and runtime flow
    • The four types of references in Java and their usage
    • Determining object death (GC eligibility)
    • String constant pool and compiler optimizations (e.g., String a = "a"+"b"+"c";)
    • Character sets and encoding formats (UTF-8, etc.)
    • Logical vs. Physical addresses
  5. Overview of Android Layouts and Inflation Process

    master

    Android development involves various layout types and a specific process for converting XML layout files into actual View objects.

    Key concepts covered in this section include:

    • Available Layout Types: Understanding the characteristics and use cases of different layouts (e.g., LinearLayout, RelativeLayout, FrameLayout).
    • Layout Inflation: The mechanism by which the Android system parses XML layout files and instantiates the corresponding View objects in memory.
    • Centering Elements: Techniques for positioning views at specific screen coordinates (e.g., placing a text view at the center of a quarter-screen) using the properties of LinearLayout or RelativeLayout.
  6. What is AIDL and when to use it

    master

    AIDL (Android Interface Definition Language) is a tool used to define a programming interface that serves as a bridge for communication between a client and a server in different processes.

    Key Characteristics:

    • Data Decomposition: Since processes cannot share memory, AIDL decomposes data into basic types that the OS understands.
    • Resource Cost: Using AIDL is resource-heavy (memory and CPU) due to the overhead of cross-process communication.

    When to use AIDL vs. alternatives:

    MechanismUse Case
    BinderWhen different apps need to access your service AND the service must handle multi-threading.
    MessengerWhen different apps need to access your service BUT you do not need to manage multi-threading (Messenger is single-threaded).
    AIDLWhen you need to define a formal interface for complex, multi-threaded cross-process communication.
  7. Understand object reclamation and System.gc() behavior

    master

    Object Reclamation via Strong References

    When a strong reference is assigned to null, the object is not necessarily reclaimed immediately. An object is eligible for Garbage Collection (GC) when no references point to it. Even if only one strong reference remains and it is set to null, the object enters a 'reclaimable' state; the actual reclamation typically occurs during the next GC cycle rather than instantly.

    System.gc() behavior

    Calling System.gc() is a hint to the JVM that it might be a good time to run the garbage collector, but it does not guarantee that the garbage collection will occur immediately or at all.

  8. Distinguish between FragmentManager types

    master

    When managing Fragments, it is critical to use the correct FragmentManager instance depending on the scope of the operation:

    • getFragmentManager(): The legacy method (deprecated in newer Android versions).
    • getSupportFragmentManager(): Used within an AppCompatActivity to manage Fragments that are part of the AndroidX/Support library.
    • getChildFragmentManager(): Used when a Fragment needs to manage its own child Fragments (nested Fragments).
  9. Understand SharedPreference thread safety and multi-process usage

    master

    When working with SharedPreferences, be aware of its behavior regarding thread safety and cross-process access:

    • Thread Safety: SharedPreferences is generally considered thread-safe within a single process because it is managed as a single instance.
    • Cross-Process Usage: Using SharedPreferences across different processes can lead to data inconsistency. If your application requires safe cross-process data storage, standard SharedPreferences may not be sufficient, and you should investigate specialized solutions or alternative storage mechanisms.
  10. Android Service Concepts

    master

    A Service is used for long-running background tasks. Key concepts include:

    • Lifecycle: Managing the service lifecycle independently of the UI.
    • IntentService: A specialized service implementation for handling asynchronous requests on a worker thread.
    • Communication: How to communicate between a Service and an Activity.
    • Process Management: Creating services that run in independent processes.
  11. Android Activity Concepts and Lifecycle

    master

    An Activity is a fundamental component representing a single screen. Key areas of study include:

    • Lifecycle: Understanding states like onCreate, onStart, onResume, onPause, onStop, and onDestroy, including how they behave during configuration changes (e.g., screen rotation), dialog popups, or when moving between foreground and background.
    • Task Stacks & Launch Modes: How Activities are managed in a task stack and how different launch modes (e.g., SingleInstance) affect navigation.
    • Communication: Methods for communicating between Activities, Fragments, and Services (e.g., using Intent or Bundle).
    • Intent & Data Passing: Using Intent to start Activities (explicit vs. implicit) and passing data via Intent or Bundle. Note that Intent has size limits for data passing.
    • Context: The role of Context in accessing system services and resources.
  12. Android Handler and Looper Mechanism

    master

    The Handler mechanism is used for message passing and thread communication within Android. Key components include:

    • Handler: Used to process messages and runnables sent to a thread's message queue.
    • Looper: Manters a message queue and dispatches messages to the appropriate Handler.
    • MessageQueue: The data structure holding the messages.
    • HandlerThread: A thread that has a Looper internally, useful for background task processing.
    • IdleHandler: A mechanism to execute code when the Looper becomes idle.
    • Message Barriers: A mechanism to prevent certain types of messages from being processed temporarily.