preface

There were two big hits in the past, 30, 20, actually just started watching these two shows and I wonder if IT’s the other way around. Isn’t 29 supposed to be 30? Think about it later, he’s trying to tell us the hard truth. In this age we have to be mature at 20 and accept the cruelty of the world. There is no time for us to be confused. The world always forces us to grow up. And 30 is a better wish for the future! 30 years old where to eat breakfast decided, you in the first ten years of struggle traces, Manny roadside stalls, Xiaoqin warm happiness, Gu Jia luxury breakfast. I have been working on Android development for seven years, and have worked for Toshiba, Oriental Group, Ali and Sany Heavy Industry. I have 15 years of project development experience, familiar with assembly, Java, C/C ++ development language, and have in-depth research on system bottom layer, Web development and mobile terminal development. It mainly involves application layer MIS, ERP project and various embedded device software (mobile phone, tablet, switch, composite machine, UAV, TV, smart home, etc.). Recently, I saw this play full of feelings, I wonder if MY life will be different if I really start over again! Without further ado, now share an Android advanced interview questions and answers.

Activity Basics

What about the Activity lifecycle?

What methods does Activity B call when Activity A starts another Activity? What if B is a transparent theme or a DialogActivity? What does the onSaveInstanceState() method do? When will it be called?

What are the four startup modes and application scenarios of the Activity?

What Flags are commonly used for activities?

What’s the relationship between an Activity and a window or a View?

Activity life cycle changes for horizontal and vertical switching?

How do I start an Activity for another application?

How does the Activity start? (key)

Fragment base correlation

What about the Fragment lifecycle?

Different from the Activity lifecycle?

What’s the difference between an Activity and a Fragment?

The difference between the fragments of the add and replace (Fragment overlap) getFragmentManager, getSupportFragmentManager, the difference between getChildFragmentManager?

FragmentPagerAdapter and FragmentStatePagerAdapter difference and usage scenarios

Service Basics

How about the life cycle of a Service?

What are the two ways to start a Service? What’s the difference?

How can Service not be killed? Can Service start time-consuming operation? How to do?

What system services have you used?

Do you know ActivityManagerService? What role does it play (key points)

Broadcast Receiver is fundamental

How many forms of broadcasting are there? What are the features?

Two ways to register a broadcast?

Do you understand the principle of broadcast sending and receiving? (Binder mechanism, AMS)

ContentProvider is fundamental

What do you know about ContentProvider?

ContentProvider permission management?

How about the relationship between ContentProvider, ContentResolver, and ContentObserver?

Data storage-related

Describe how Android data persistence works?

The application scenarios of SharedPreferences? What to note?

What is the difference between apply and commit in SharedPrefrences?

Do you know anything about transactions in SQLite? Is there a good way to use SQLite to do batch operations?

How do I delete individual fields of tables in SQLite?

What optimizations do I get when I use SQLite?

IPC (Emphasis)

What is the relationship between processes and threads in Android? The difference between them?

How do I enable multiple processes? Can N processes be enabled for an application?

Why is IPC needed?

Possible problems with multi-process communication?

Android IPC, advantages and disadvantages of various ways, why Binder?

What and how does the Binder mechanism work?

What is the role of ServiceManager in Binder framework?

Why do Bundle delivery objects need to be serialized? The difference between Serialzable and Parcelable?

Tell me about an AIDL? How does it work? How to optimize AIDL for multiple modules?

View related

What’s the process of drawing a View?

What is a MotionEvent? How many events are involved? Under what conditions does it occur?

Describe the View event delivery and distribution mechanism?

How to resolve View event conflicts? What is an example from development?

The difference between scrollTo() and scollBy()?

How does Scroller achieve elastic sliding of View?

How does invalidate() differ from postInvalidate()?

What’s the difference between SurfaceView and View?

How does custom View consider model adaptation?

Handler associated

What about the message mechanism Handler? Role? What are the elements? What is the process?

Can a thread create more than one Handler?

The difference between soft references and weak references The cause of memory leaks caused by handlers and the best solution

Why is it not recommended to access the UI on child threads

What happens to message queues when you use Handler’s postDealy?

Can I just new a Handler on a child thread? How to do?

How can messages be created? Which works better? Why is that?

Thread (emphasis) related

What are the benefits of thread pools?

Thread pool: thread pool: thread pool: thread pool: thread pool: thread pool: thread pool: thread pool

So AsyncTask what does IntentService do?

The difference between creating a thread directly in an Activity versus creating a thread in a service

How does ThreadPoolExecutor work?

What is the difference between Handler, Thread, and HandlerThread?

Whether multithreading is always efficient (pros and cons)

If you were asked to do a singleton, what would you do

Is there any other way to wake up a thread besides notify

What is ANR? When does ANR occur? How to avoid it?

How can I quickly locate ANR problems without looking at the code?

Bitmap related

What are some issues to be aware of when using Bitmap?

Will bitmap.recycle () be recycled immediately?

When will it be recycled? If there’s nowhere to use this Bitmap, why isn’t garbage collection just collected?

How much memory does a Bitmap occupy and how much memory does it occupy?

How does LRU work?

Performance optimization (emphasis)

In the image level 3 cache, the image is loaded into memory, and if memory is about to burst, what happens? How to deal with it?

If you load a 500*500 PNG hd image in memory. How much memory should it take up?

WebView performance optimization?

How Bitmap handles large images, such as a 30M large image, how to prevent OOM memory reclamation mechanism and GC algorithm (advantages and disadvantages of various algorithms and application scenarios); GC principles, timing, and GC objects

What’s the difference between a memory leak and an overflow?

What tools does AS have to detect memory leaks

Performance optimization, how to ensure that the application startup does not lag?

How to deal with black and white screen?

Will strong references be reclaimed if they are set to NULL?

The difference between ListView and RecyclerView, ListView adapter is what adapter?

LinearLayout, FrameLayout, RelativeLayout performance comparison.

JNI related

Do you know anything about JNI about how to load NDK libraries?

How to register Native functions in JNI?

What functionality have you implemented with JNI? How do you do that? (Encryption, audio and video, graphics and image processing)

Design pattern correlation

What design patterns do you know?

Talk about MVC, MVP, and MVVM. What’s good and what’s bad?

After encapsulating the P layer, if the P layer data is too large, how to solve the problem? Can you give some examples from Android to tell us what design mode is used?

What are the differences between decorator mode and proxy mode?

How many ways are there to implement the singleton pattern?

What is the purpose of double locking in the slacker style? What is the purpose of two short calls?

Use of some open source framework, introduced a read source code, internal implementation process.

How should fragments be decoupled if used in Adapter? .

** All interview questions and answers have been compiled into PDF files, as shown below: ** Study notes are freely shared.If you need itYou can pick it up for free here.

More Android knowledge sharing

  • Essential skills for architects to build foundations

At present, the mainstream Android APP development language is Java language, the biggest feature of Java language is to improve the possibility of software interaction, it can be said that almost all applications of Android phones are written using Java language.

Key points of knowledge: 1. In-depth understanding of Java generics 2. Simple annotations 3. Concurrent programming 4. Data transfer and serialization 5

  • Design ideas read open source frameworks

With the continuous development of Internet enterprises, there are more and more modules in product projects, and the user experience requirements are getting higher and higher. It is more and more difficult to achieve the purpose of small steps and rapid iteration, so plug-in technology is born. Without plug-in technology, meituan and Taobao, which integrate a large number of “apps”, would be several gigabytes in size.

As a result, Android mobile development today is not hotfix, plug-in, componentized, and 80% of interviews fail.

Key points of knowledge: 1, hot repair design 2, plug-in framework design 3, component framework design 4, picture loading framework 5, network access framework design 6, RXJava responsive programming framework design

  • 360° all-round performance tuning

In the hands of development engineers at different levels, due to the uneven technical level, even though many mobile phones have very high performance of scoring software, there is still a lag phenomenon when opening applications.

In addition, as product content iterates and features become more complex, the UI pages become richer, which can become a barrier to smooth operation. To sum up, APP performance optimization has become a comprehensive quality that developers should have, and it is also a guarantee that developers can complete high-quality application works.

1. Design ideas and code quality optimization

2. Program performance optimization

  • Optimization of startup speed and execution efficiency
  • Layout detection and optimization
  • Memory optimization
  • Optimize the power consumption
  • Network transmission and data storage optimization
  • APK size optimization

3. Optimization of development efficiency

  • Git, a distributed version control system
  • Automated build system Gradle

4. Actual project combat

  • startup
  • fluency
  • The practice of Douyin in APK packet size resource optimization
  • Youku responsive layout technology full analysis
  • Network optimization
  • Mobile Taobao Double 11 performance optimization project revealed
  • Autonavi APP full link source code dependency analysis
  • Complete the OOM experience sharing
  • Wechat Android terminal memory optimization practice

  • Android framework architecture

Android FrameWork architecture (advanced UI+FrameWork source code) this piece of knowledge is the most users today, we call Android2013~2016 technology.

Android developers also tend to be familiar with the “used” code because they are used to online Copy code. The familiar is that they work with it almost every day and Copy it every day. What is strange is that although I deal with these codes every day, I have not studied the principle of these codes and the connotation of the code.

This knowledge points: 1, advanced UI promotion 2, Android kernel components 3, large project essential IPC 4, data persistence and serialization 5, Framework kernel parsing

  • NDK Module Development (Audio and Video series)

NDK (Native Development Kit) A software Development Kit based on a Native programming interface that allows you to leverage C and C++ code in Android applications. Programs developed with this tool run directly locally, rather than on a virtual machine.

In Android, the NDK is a collection of tools that extend the Android SDK. The NDK provides a set of tools to help developers quickly develop dynamic libraries in C or C++, and automatically package so and Java applications together as APK.

This article knowledge key points: 1, NDK development of C/C++ introduction 2, JNI module development 3, Linux programming 4, bottom picture processing 5, audio and video development 6, machine learning

  • Flutter learning is advanced

2019 is undoubtedly the year that Flutter technology is in full swing.

Every mobile developer has been fascinated by the features and ideas that Flutter brings with it: “rapid development, expressive and flexible UI, native performance”, from superapps to standalone apps, from pure Flutter to hybrid stacks, Developers have been exploring and applying Flutter technology in a variety of scenarios and are facing a variety of challenges.

Build your first Flutter development environment in Windows. Write your first Flutter APP. Get started with the Flutter Dart language.

  • Wechat small program development

Wechat small program as one of the more popular programming development application scenarios, favored by the market, which makes many developers greedy. But for beginners, it is completely confused, do not know the micro channel small program development and production need to learn those knowledge, friends in need can refer to this article.

This knowledge key points: 1, small program overview and introduction 2, small program UI development 3, API operation 4, shopping mall project combat

  • Android related source code interpretation as long as programmers, whether Java or Android, if not to read the source code, only look at THE API document, it is just stay in the fur, which is unfavorable to the establishment of our knowledge system and complete and the promotion of actual combat technology.

Due to the space, the above complete study notes PDF if necessary, please help to like it.Click here to get it for free!

More information on the Android architecture is available for free here