As we all know, in this age of quizzes, Android interview questions are no longer as difficult as they used to be. In addition to the foundation, the interview of dafang attaches more importance to the breadth and depth of the interviewers’ knowledge. As an Android developer, you should not only lay your foundation, but more importantly, build your own knowledge system. This article is a collection of Android interview questions that I spent nearly a year collecting. It mainly covers two parts: Java basic part and Android part, in addition, there are not perfect computer network topic and algorithm topic.

First of all, I admit that this article is a bit of a “Proprietary Nail Front Interview Guide,” but it’s definitely dry stuff. After all, why is it only allowed to have a good interview summary on the front end when I can’t on Android (manual funny)? In addition, it should be noted that the questions and answers below are from my GitHub repository, AndroidNote. Most of the content is my own notes and summaries, with a large portion taken from the web. From the Internet, answers are usually followed by a link to the source.

Java based

Java part is the focus of the big factory interview, pay attention to the basic investigation. The following content covers the basics of common interview questions, such as collections, JVMS, and multi-threading.

Java Object-oriented and basics

  • What’s in Java for “==” and equals

  • Why does overriding equals have to overriding hashCode

  • How many strings does the following code generate in the JVM? How does the JVM allocate memory for it?

  • Know the String method intern()? What does it do?

  • What is the difference between String, StringBuffer and StringBuilder?

  • Access modifier public, private, protected, and don’t write what is the difference between (the default)?

  • What are the uses of final? What does each use mean?

  • The role of static key

  • Can an inner class reference members of an outer class? Are there any restrictions?

  • What is the difference between int and Integer?

  • What are the aspects of Java object-oriented characteristics?

  • Java reflection mechanism, the role and application of reflection?

  • What are Java generics? What about type erasure for generics?

Java Collections Framework

  • The Hash table with a HashMap

  • How HashMap works

  • Why does HashMap have an infinite loop problem with multiple threads concurrently, and what optimizations have been made in JDK1.8?

  • What is the difference between Hashtable and HashMap?

  • Do you know ConcurrentHashMap? How does it work?

  • Can I use CocurrentHashMap instead of Hashtable?

  • Are there any defects with ConcurrentHashMap?

  • ConcurrentHashMap: The difference between JDK 7 and 8

  • What’s the difference between a HashMap and a HashTable in Java?

  • The difference between HashMap and HashSet

  • What’s the difference between an ArrayList and a LinkedList?

  • What’s the difference between an ArrayList and a LinkedList?

  • What is the difference between Set and List in Java?

JVM

  • Memory allocation for the JVM

  • Java’s garbage collection mechanism

  • The JVM class loading process

Multithreading and Concurrency

  • Multithreading and concurrency fundamentals

  • JMM and volatile keywords

  • The implementation principle of synchronized

  • The CAS, Unsafe classes, and Automic send packages

  • AQS implementation principle

  • Implementation principle of ReentrantLock

  • Implementation principle of ThreadLoacal

  • Thread pool implementation principle

  • Java thread interrupt mechanism

  • Java wait and wake mechanism

Android

The Android section covers a wide range of content. It mainly includes basic frequently asked questions, Android message mechanism, event distribution mechanism, View drawing process, screen refresh mechanism, performance optimization, Framework project, Jetpack component principle, and the implementation principle of third-party Framework, etc. Technical depth can deal with the basic domestic first-line big factory.

Android Basics

  • Summary of Basic Android knowledge

  • SparseArray implementation principle

  • Implementation principle of ArrayMap

  • SharedPreferences

Android Messaging Mechanism

  • This section describes the implementation principle of Handler

  • How many handlers does a thread have? How many Looper does a thread have? How to guarantee it?

  • How does the Handler thread switch?

  • What causes Handler memory leaks? How to solve it?

  • What should I pay attention to when using Looper in child threads? What’s the use?

  • How does MessageQueue ensure thread safety?

  • How do we create Message when we use it?

  • Why does Looper loop not cause the app to get stuck?

  • Can a Message be expedited?

  • What are the synchronization barriers for handlers?

  • What is the blocking wake-up mechanism for Handler?

  • Implementation principle of ThreadLocal

  • What is HandlerThread?

  • What is an IntentService?

  • What is IdleHandler?

View Event distribution mechanism

  • Event distribution process

  • What is the mFirstTouchTarget in the ViewGroup, and what does it do?

  • What happens if we intercept ACTION_DOWN events in the ViewGroup?

  • Why is onClickListener not called after onTouchListener is set?

  • Why does a View with setOnTouchListener set get a warning that it does not reference the performClick method?

View drawing process

  • Describe the drawing process of a View

  • XML Parsing Principles

  • MeasureSpec What is MeasureSpec?

  • RequestLayout, Invalidate, and postInvalidate

Android screen refresh mechanism

  • Overview of the screen refresh mechanism

  • Choreographer,

  • SurfaceFlinger

  • What causes frame loss in general?

  • Will I lose frames if I draw onDraw when the screen is about to refresh

  • If you call requestLayout 10 times quickly, will you call onDraw 10 times?

  • Describe the UI rendering process

  • View refresh mechanism

Performance optimization

  • Memory optimization Strategy

  • UI interface and lag optimization

  • App startup optimization

  • ANR problem

  • Package volume optimization

  • APK packaging process

  • Battery power optimization

  • Android Screen Adaptation

  • Online performance monitoring 1– Online monitoring entry point

  • Online performance monitoring 2–Matrix implementation principle

Framework

  • Binder with AIDL

  • Binder Implementation Principle

  • Android startup process

  • InputManagerService

  • WindowManagerService

  • ActivityManagerService

  • SurfaceFlinger

  • APP startup Process

  • PMS installation and signature verification

  • Dalvik and ART

  • Core Principles of Fragment

Jetpack & system View

  • The implementation principle of ViewModel

  • WorkManager implementation principle

  • Lifecycle implementation Principle

  • RecyclerView Implementation principle

Third party framework implementation principle

  • Glide realization principle

  • OkHttp implementation principle

  • How Retrofit is implemented

  • RxJava implementation principle

  • Butterknife implementation principle

  • ARouter implementation principle

Computer network

  • This section describes the TCP/IP protocol

  • The difference between TCP and UDP

  • TCP three-way handshake

  • Four waves of TCP

  • IP protocol related technologies

  • What are the main differences between Http get and POST?

  • The HTTP protocol

  • Implementation principles of HTTPS

  • Socket

algorithm

  • Sorting algorithm

  • Search algorithm

  • List relevant

  • An array of relevant

  • Binary tree

  • string

  • recursive

other

  • Building componentized WebView architecture

  • Frequently Asked QUESTIONS about HR