Related Articles:
Awesome! 74 Complete APP Source Codes!
[Valuable Resources, Worth Collecting] A comprehensive collection of internal interview questions from top internet companies. With this, my mom doesn’t have to worry about me not getting into a big company anymore!
[Valuable Insights, After Reading, BAT is Not a Dream] Interview experiences and summaries — BAT, NetEase, Mogujie
[Quality Resources] The second wave of interview questions: 56 interview questions you will definitely encounter in Java interviews
[Interview Benefits] How to get into Baidu and Alibaba, insights from a 6-year Android veteran
2016 Baidu Campus Recruitment Summary: Some thoughts from my experience as a technical interviewer (If you want to join Baidu, look quickly)
Author: Yin Star
Original Article: http://www.jianshu.com/p/a22450882af2
Introduction
As the year-end bonuses are distributed, many Android developers might be gearing up for interviews. Combining my past experiences, today I will summarize some Android interview questions that I hope will be helpful.
What is the Activity lifecycle?
This is a classic question that will never go out of style and is likely to be the first question asked. There’s really not much to say about this question; rote memorization won’t help much, understanding is key. I once encountered a variant of this question asking about the difference between onStart() and onResume(). If the interviewer throws this question at you, it might catch you off guard. Today, I heard that a classmate faced an even trickier question: Under what circumstances does an Activity go through onCreate() but not onStart()? This is simply a brain teaser.
What is the Service lifecycle?
Here, it’s important to note that there are two ways to start a service: startService() and bindService()
Understanding the relationship between Activity, View, and Window
This question is really difficult to answer. So let’s start with a metaphor to describe their relationship. An Activity is like a craftsman (control unit), a Window is like a window (holding the model), a View is like a decorative window (displaying the view), LayoutInflater is like scissors, and XML configuration is like the design of the decorative window. 1: When an Activity is constructed, it initializes a Window, specifically a PhoneWindow. 2: This PhoneWindow has a “ViewRoot,” which is a View or ViewGroup, the initial root view. 3: The “ViewRoot” adds Views one by one via the addView method, such as TextView, Button, etc. 4: The event listeners for these Views are handled by WindowManagerService, which receives messages and callbacks to Activity functions, like onClickListener, onKeyDown, etc.
The four types of LaunchMode and their usage scenarios
standard mode This is the default mode; each time the Activity is activated, a new instance of the Activity is created and placed in the task stack. Usage scenario: Most Activities. singleTop mode If an instance of that Activity already exists at the top of the task stack, it reuses that instance (calls onNewIntent()), otherwise it creates a new instance and places it at the top of the stack. Even if an instance of that Activity exists in the stack, as long as it is not at the top, a new instance will be created. Usage scenarios include news or reading apps. singleTask mode If an instance of that Activity already exists in the stack, it reuses that instance (calls onNewIntent()). When reused, that instance will be brought to the top of the stack, and any instances above it will be removed from the stack. If that instance does not exist in the stack, a new instance will be created and placed in the stack. Usage scenarios include the main interface of a browser. Regardless of how many applications start the browser, only the main interface will be started once, and other instances will call onNewIntent, clearing other pages above the main interface. singleInstance mode Creates an instance of that Activity in a new stack and allows multiple applications to share that Activity instance in that stack. Once an instance of that Activity in this mode exists in a stack, any application activating that Activity will reuse the instance in that stack (calls onNewIntent()). Its effect is similar to multiple applications sharing one application; regardless of who activates that Activity, they will enter the same application. Usage scenarios include alarm reminders, separating alarm reminders from alarm settings. singleInstance should not be used for intermediate pages; if used for intermediate pages, navigation will have issues, for example: A -> B (singleInstance) -> C, after fully exiting, starting here will first open B.
View rendering process
Measure processLayout processDraw process No more worries about custom Views – Detailed explanation of Android custom views
Android View rendering source code analysis (part 1)
Android View rendering source code analysis (part 2)
Touch event passing mechanism
public boolean dispatchTouchEvent(MotionEvent ev);
// Used to dispatch event
public boolean onInterceptTouchEvent(MotionEvent ev);
// Used to intercept event
public boolean onTouchEvent(MotionEvent ev);
// Used to handle event
Both Activity and View controls (TextView) have methods to dispatch and handle events, while View containers (LinearLayout) have methods to dispatch, intercept, and handle events. Here’s a metaphor: Leaders delegate tasks downward; if the people below do not do well, they will not delegate further tasks to them, but will do it themselves. If they cannot do it either, they can only report to their superiors that they cannot complete the task, and their superiors will repeat this process. Additionally, leaders have the authority to intercept tasks, directly doing them themselves while hiding the task from subordinates. If they cannot complete it, they can only report to their superiors.
Several types of animations in Android
I was once asked how many types of animations there are in Android, and this question is quite difficult to answer. Before Android 3.0, there were 2 types, and after 3.0, there are 3 types. FrameAnimation (frame animation): Combines multiple images for playback, similar to the working principle of early movies; many apps use this method for loading. TweenAnimation (tween animation): A series of animations applied to a View, including fade in and out (Alpha), scaling (Scale), translation (Translate), and rotation (Rotate). PropertyAnimation (property animation): Property animation is no longer just a visual effect but a mechanism for continuously operating on values and assigning them to specified properties of specified objects, which can be any property of any object.
Android animations, this is enough after reading these (part 1)
Android animations, this is enough after reading these (part 2)
http://blog.csdn.net/yanbober/article/details/46481171
Several ways of inter-process communication in Android
1: Accessing other applications’ Activities For example, calling the system dialer application
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:12345678"));
startActivity(callIntent);
2: Content Provider For example, accessing the system gallery
3: Broadcast For example, displaying system time
4: AIDL service
Understanding AIDL
http://bbs.51cto.com/thread-1086040-1.html
Principles of Handler
IntentService – Combining Handler and Service
Optimizing runtime speed and performance in Android development using asynchronous methods
In-depth understanding of ThreadLocal (part 1)
http://blog.csdn.net/lmj623565791/article/details/38377229
Principles of the Binder mechanism
Why does Android use Binder as the IPC mechanism?
http://blog.csdn.net/boyupeng/article/details/47011383
Principles of hotfixing
1: JavaSisst 2: AspectJ 3: Xposef Alibaba’s Android hotfix technology selection – Analysis of three major factions
Analysis of Android hotfix solutions
Android hot update: Meituan’s hot update solution for Android Robust
Using AndFix for hotfix in Android pluginization
Designing an image asynchronous loading and caching solution
http://www.cnblogs.com/zyw-205520/p/4997863.html http://blog.csdn.net/boyupeng/article/details/47127605
Memory leaks and management in Android
Research on Android memory leaks
Summary of Android memory leaks (part 2)
Android memory performance optimization (internal material summary)
5 common memory leak issues in Android development and their solutions
Actual cases of locating and solving Android memory leak issues
[Valuable Resource] Practical analysis and insights on Android memory leaks – Common interview points
Discussing Android memory leaks again – Eight common problems leading to APP memory leaks
The most comprehensive and systematic Android interface performance tuning materials
http://gold.xitu.io/entry/56d64b9e816dfa005943a55c
Communication between Activity and Fragment
[Valuable Resource] Understanding Context thoroughly, if you don’t get it, how can you do Android development?
http://gold.xitu.io/entry/56a87b2b2e958a0051906227
Pits of Fragment
http://www.jianshu.com/p/d9143a92ad94 http://www.jianshu.com/p/fd71d65f0ec6 http://www.jianshu.com/p/38f7994faa6b
Android UI adaptation
Summary of Android UI layout issues
Embracing SVG: Struggling with image adaptation in Android? Universal image adaptation
http://blog.csdn.net/lmj623565791/article/details/45460089
Layout optimization
Android performance optimization series – Improving Layout Performance (part 1)
Android performance optimization series – Improving Layout Performance (part 2)
Android performance optimization series – Improving Layout Performance (part 3)
Performance optimization in layout
Practical tips for Android layout optimization
Suggestions for efficient Android layouts
What is ConstraintLayout introduced at Google I/O 2016? A new world of Android Layout
Summary of Android UI layout issues
Performance analysis of RelativeLayout and LinearLayout in Android
Overdraw optimization in Android layout
http://www.jianshu.com/p/145fc61011cd
HTTP and HTTPS
Simple introduction to common communication protocols HTTP, TCP, UDP
Discussing what the HTTP protocol does based on daily development
The most detailed introduction to HTTPS
Explaining how HTTPS ensures security?
http://www.jianshu.com/p/93fdebe5fef1
Network request optimization
Practical experience in network performance optimization of the Ctrip App
Research on Android push technology
http://www.jianshu.com/p/3141d4e46240
Database optimization
Performance optimization issues of SQLite on Android
Analysis of SQLite’s locking mechanism and WAL technology
http://www.jianshu.com/p/3b4452fc1bbd
Image optimization
Comparison of the three major image caching principles and characteristics in Android
The most comprehensive and detailed explanation of Facebook’s powerful Android image loading framework Fresco
Getting to know Facebook’s powerful Android image loading framework: Fresco
Embracing SVG: Struggling with image adaptation in Android? Universal image adaptation
http://www.jianshu.com/p/5bb8c01e2bc7
Hybrid JAVA and JS interaction
Communicating well with H5! Several common hybrid communication methods
A glimpse into hybrid mobile app development with Ionic
Douban hybrid development practice
http://droidyue.com/blog/2014/09/20/interaction-between-java-and-javascript-in-android/
Singleton design pattern
Detailed explanation of the singleton design pattern
Java GC principles
Research on Android memory leaks
Understanding the architecture of the Android virtual machine
JVM Insights: Detailed explanation of the Java virtual machine
http://www.jianshu.com/p/d75a32ac5bed?
ANR
Android performance optimization series – Avoiding ANR
http://www.jianshu.com/p/124f3b75e164
Volley
Dribbble client based on MVP architecture and MD style
http://www.jianshu.com/p/9e17727f31a1
Java annotation reflection principles
http://www.jianshu.com/p/3968ffabdf9d
Algorithms
10 essential practical algorithms every programmer should know and their explanations
Algorithm fun talks – Comic: Judging the power of 2 – Making algorithm learning less tedious
[Fun Talks on Algorithms Series]: The maximum adjacent difference after sorting an unordered array
http://www.jianshu.com/p/ae97c3ceea8d
Design patterns
Detailed explanation of the Adapter design pattern
Summary of the Observer pattern
Detailed explanation of the Singleton design pattern
The “Memento pattern” is that simple
The design architecture of Android Apps: MVC, MVP, MVVM and architectural experiences
http://gold.xitu.io/entry/56ebb4ad5bbb50004c440972
RxJava
Constructing a clear framework for Android using RxJava
Airbnb: How our Android client uses RxJava
A great Android APP framework
http://gank.io/post/560e15be2dca930e00da1083?from=timeline&isappinstalled=0#toc_1
MVP, MVC, MVVM
Analysis of the official MVP architecture example project from Android
Interpretation of the official MVP architecture example project from Android
The design architecture of Android Apps: MVC, MVP, MVVM and architectural experiences
A brief discussion on Android programming thoughts and architecture
APP refactoring: From MVC architecture to MVP architecture in Android practice
Practical experience in Android open-source: Developing a text reading APP using MVP + Retrofit
http://blog.csdn.net/pkxiuluo01/article/details/49383783
React Native cross-platform technology
Popularizing React Native – The hottest front-end technology currently
Practical integration of React Native for Android
https://mp.weixin.qq.com/s/i0DWHR2eQmNijXTQv3YGmQ
Android 5.0
Dribbble client based on MVP architecture and MD style
An APP developed based on Retrofit2.1 + Material Design + ijkplayer (news, gif, video playback)
http://www.androidchina.net/1381.html
Android 6.0 runtime permissions
Android 6.0 permission adaptation, simpler than you think (practical part)
Android 6.0 (API level 23) includes various system changes and API behavior changes
Understanding the touch event distribution mechanism in Android 6.0
https://mp.weixin.qq.com/s/R2sAthMB2yW3ytTesnT-Jw
New features of Android 7.0
Summary of new features in Android 7.0, look at what unexpected things Google has?
Tutorials and insights on adapting to Android 7.0
Top 10 new features of Android N that everyone is looking forward to
http://blog.csdn.net/wds1181977/article/details/52292445
Android pluginization and compositional development
Using AndFix for hotfix in Android pluginization
The principle of Android sub-packaging
One implementation of Android pluginization
The cornerstone of pluginization is APK dynamic loading
Tuniu Original | The realization of plugins in Tuniu’s Android App
http://www.cnblogs.com/android-blogs/p/5703355.html
About the Java and Android Expert Channel
The Java and Android Expert Channel is a public account with tens of thousands of followers discussing Java and Android development, sharing and creating the most valuable articles to help you become an expert in this field!
We discuss cutting-edge technologies in Android and Java development: Android performance optimization, pluginization, cross-platform, dynamicization, strengthening and anti-cracking, etc., as well as design patterns/software architecture among others, by a team of engineers from BAT.
Follow us to receive red packets, reply with: “Baidu”, “Alibaba”, “Tencent” for surprises!!! After following, you can join the WeChat group. The group consists of experts from Baidu, Alibaba, and Tencent.
Welcome to follow us, let’s discuss technology together, scan and hold the QR code below to quickly follow us. or search for the public account: JANiubility.
Public Account:JANiubility
Leave a Comment
Your email address will not be published. Required fields are marked *