origin

It has been some time since I contacted Android, and I always search for answers on the Internet when I encounter difficult problems in my work. I would like to express my heartfelt thanks to you all for sharing your experience and helping those who need help. However, now THAT I have thought it over, it is time for me to share my problems and solutions, hoping to help those in need.

As time goes on, many people say that the Internet has become more and more difficult to do, because the days of burning cash are over, the rest are big, established companies, and the unicorns no longer exist. This directly led to the decline of Internet jobs, I personally measured, it is true.

In May 2016, I left my job (3 years of work experience, working in Shenzhen), and began to test the Android market, looking for a suitable and stable medium and large company. I applied to a lot of companies, but I didn’t get as many interviews as I thought I would, the instant interview went well and I didn’t get any offers (too many candidates). But I’ve taken the opportunity to interview 10 companies, and here are some of the questions I’ve been asked, along with some tips for your upcoming interview.

Android

1.Activity

  • 1. The process for starting an Activity
  • 2. Timing of onSaveInstanceState(),onRestoreInstanceState
  • 3. Startup mode and usage scenario of the activity
  • 4.Activity A jumps to Activity B, and then presses the return key, the sequence of life cycle execution
  • 5. To switch between vertical and horizontal screens, press the Home button, press the return button, lock and unlock the screen, jump to the transparent Activity interface, start an Activity with Theme as Dialog, and pop up the life cycle of the Activity when Dialog is displayed
  • 6. The difference between onStart and onResumeonPause and onStop
  • 7. How to pass data between activities. Does an Intent have a size limit
  • 8. When does the onNewIntent() method of the Activity execute
  • 9. Display startup and implicit startup
  • 10. Scheme Usage scenario, protocol format, and how to use it
  • 11. Four scenarios of ANR
  • 12. The difference between onCreate and onRestoreInstance methods when restoring data
  • 13. Data transfer between Activty
  • 14. How to start an Activity across apps, and matters needing attention
  • 15. What is the Activity task stack
  • 16. What Flags are commonly used by activities
  • 17. How is the Activity data saved? How is the saved data restored after the process is killed

2.Service

1. Life cycle of the service and the difference between the two startup modes

  • 2.Service Starts the process
  • 3. How to communicate between Service and Activity
  • IntentService IntentService IntentService IntentService IntentService IntentService IntentService IntentService
  • 5. How many returns does the onStartCommand method of Service return? What does each stand for?
  • 6. How to close the life cycle of bindService and startService

3.BroadcastReceiver

  • 1. Classification and usage scenarios of broadcast
  • 2. Differences between the two registration methods for broadcasting
  • 3. Principles of broadcast transmission and reception
  • 4. Differences between local and global broadcast

4.ContentProvider

  • 1. What is ContentProvider and its use

  • 2. Relationship between ContentProvider[,]ContentObserver

  • 4. What are the advantages of ContentProvider? 5

5.Handler

  • 1. Implementation principle of Handler
  • 2. Can a child thread directly new a Handler? Why can the main thread Looper first call loop? When and which class
  • 3. Causes and solutions of memory leaks caused by Handler
  • 4. A thread can have several handlers, several Loopers, and several MessageQueue objects
  • 5. What are the differences in how Message objects are created? How does message.obtain () maintain the Message pool
  • 6. What methods does Handler have to send messages
  • 7. Differences and application scenarios between Handler Post and sendMessage
  • 8. What happens to the handler postDealy message queue after the handler postDelay is 10 seconds and then 1 second
  • 9. What is a MessageQueue
  • 10. How to ensure that only one MessageQueue ThreadLocal function in the Handler mechanism
  • 11. What is HandlerThread & benefits & Principles & Usage scenarios
  • 12.IdleHandler and its application scenarios
  • 13. Message barrier, synchronization barrier mechanism
  • 14. Can a child thread update the UI
  • 15. Why does Android not recommend child threads to access the UI
  • Looper.loop() MessageQueue#next block when there is no message. How to recover?
  • When an Activity has multiple handlers, how does a looper know which Handler handles the current message and which callback handles the message
  • The difference between 18. Stars. Quit/quitSafely
  • 19. How to achieve thread switching through Handler
  • 20. How is Handler associated with Looper
  • 21. How is Looper related to Thread
  • 22. The stars. The loop () the source code
  • 23. How does the enqueueMessage() method of MessageQueue synchronize threads
  • 24. Inside the Next () method of MessageQueue
  • 25. Can MainLooper be used to create Handler in a subthread? Must Looper and Handler be in the same thread
  • 26. Contact between ANR and Handler

6. The View map

  • 1.View drawing process
  • 2. The MeasureSpec is what
  • MeasureSpec (MeasureSpec) MeasureSpec (MeasureSpec
  • 4. Why customizing Viewwrap_content does not work
  • 5. There are several ways to get the width and height of a View in an Activity
  • 6. Why can’t onCreate get the width and height of the View
  • View#post = Handler#post = View#post
  • 8.Android drawing and screen refresh mechanism
  • 9. Choreography principle
  • 10. What is double buffering
  • 11. Why use SurfaceView
  • 12. What is a SurfaceView
  • 13. The difference between View and SurfaceView
  • 14. Why can SurfaceView be drawn directly to subthreads
  • SurfaceView, TextureView, SurfaceTexture, GLSurfaceView
  • 16. Difference between getWidth() method and getMeasureWidth() method
  • 17. Difference between invalidate() and postInvalidate()
  • 18.Requestlayout, onLayout, onDraw, DrawChild
  • Which is more efficient, LinearLayout, FrameLayout or RelativeLayout
  • 20. Drawing process of LinearLayout
  • 21. Process and precautions for customizing View
  • 22. How to consider the model adaptation for custom View
  • 23. Custom control optimization scheme
  • How to partially refresh invalidate
  • 25.View Loading process (setContentView)

7.View event distribution

  • 1.View event distribution mechanism
  • 2. The onTouch method of the view’s onTouchEvent, OnClickListerner and OnTouchListener are prioritized
  • 3. The difference between onTouch and onTouchEvent
  • 4. When does ACTION_CANCEL trigger
  • Whether the event goes to the DecorView or Window first
  • 6. Click event is blocked, but want to upload to the following View, how to operate
  • 7. How to resolve View event conflicts
  • 8. Consume ACTION_DOWN event in ViewGroup onTouchEvent
  • 9. The Activity ViewGroup and View do not consume ACTION_DOWN
  • 10. Set the click method for both the parent View and the child View, and choose which one to respond to first
  • 11. The call time to requestDisallowInterceptTouchEvent

8.RecycleView

  • 1. The multi-level cache mechanism of RecyclerView, what is the specific role of each level of cache, and what cache will be used in what scenarios
  • 2. Sliding recycle reuse mechanism of RecyclerView
  • 3.RecyclerView refresh recycle reuse mechanism
  • 4.RecyclerView Why to pre-layout
  • 5.ListView and RecyclerView difference
  • 6.RecyclerView performance optimization

9.Viewpager&Fragment

  • 1. Lifecycle of Fragment & Lifecycle of Activity
  • 2. How to communicate between an Activity and a Fragment
  • 3. Why use fragment.setarguments (Bundle) for arguments
  • 4. Differences and usage scenarios between FragmentPageAdapter and FragmentStatePageAdapter
  • 5. Fragments lazy loading
  • ViewPager2 and ViewPager
  • 7.Fragment nesting problem

10.WebView

  • 1. How to improve WebView loading speed
  • 2. Interaction between WebView and JS
  • 3. The WebView loopholes
  • 4. JsBridge principle

11. The animation

  • 1. Type of animation
  • 2. The difference between tween animation and property animation
  • 3.ObjectAnimator, ValueAnimator and their differences
  • 4.TimeInterpolator, custom interpolator
  • 5. TypeEvaluator valuations

12.Bitmap

  • 1. Calculate the Bitmap memory usage
  • 2. The difference between getByteCount() and getAllocationByteCount()
  • 3. Compression method of Bitmap
  • 4. Principles of LruCache & DiskLruCache
  • 5. How to design an image loading library
  • 6. There is a very large image, how to load this large image
  • 7. If the drawable- xxHDpi image is moved to drawable- xHDpi, how to change the image memory?
  • 8. If images are placed under HDPI and XXHDPI, load priority. If it is 400800,10801920, the priority for loading.

13.mvc&mvp&mvvm

  • 1.MVC and its pros and cons

  • 2.MVP and its pros and cons

  • 3.MVVM and its advantages and disadvantages

  • 4. How does MVP manage Presenter lifecycle and when to cancel network requests

14.Binder

  • 1. The relationship and difference between processes and threads in Android
  • 2. Why IPC is needed and what problems may occur in multi-process communication
  • 3. The IPC method in Android has several advantages and disadvantages
  • 4. Why add Binder as primary IPC
  • 5. What is Binder
  • 6.Binder Principles How does Binder Driver make a copy in the kernel space?
  • 7. Data transmission with the Binder
  • 8. Roles of the ServiceManager in the Binder framework
  • 9. What is AIDL
  • 10. Steps to use AIDL
  • 11. What data types are supported by AIDL
  • 12.AIDL key classes, methods, and workflows
  • 13. How to optimize the use of AIDL in multiple modules
  • 14. What is the maximum amount of data that can be transmitted with Binder, and what will happen if Binder is used up
  • 15. What are the important steps for Binder driver loading
  • 16. Differences between system services and services started by bindService
  • 17.Activity bindService process
  • 18. Manual coding is used to communicate with Binder without AIDL

15. Memory leak & Memory overflow

  • 1. What is an OOM & What is a memory leak and why
  • 2. How does Thread cause memory leak and how to solve it?
  • 3. What are the causes of memory leaks caused by Handler and how to solve them
  • 4. How can I load a Bitmap to prevent memory overflow
  • 5. How is the Presenter layer handled in MVP to prevent memory leaks

16. Optimize performance

  • 1. Optimize memory
  • 2. Start tuning
  • 3. Layout loading and drawing optimization
  • 4. Caton optimization
  • 5. Optimize the network

17.Window&WindowManager

  • 1. What is Window
  • 2. What is WindowManager
  • 3. What is ViewRootImpl
  • 4. What is a DecorView
  • 5. The relationship between Activity, View and Window
  • 6. When was the DecorView added to Windows manager

18.WMS

  • 1. What is WMS
  • 2. How does WMS manage Windows
  • 3. What is IWindowSession? What is the process of creating a WindowSession
  • 4. What is WindowToken
  • 5. What is WindowState
  • 6. How many Android Windows are there? What is the grouping principle
  • Dialog Context can only be an Activity Context, not an Application Context
  • 8. How does the App App communicate with SurfaceFlinger? How does the drawing of the View pass the data to SurfaceFlinger
  • 9. What is the implementation of shared memory
  • 10. How did Relayout apply for Surface from SurfaceFlinger
  • 11. What is Surface

19.AMS

  • 1. What is ActivityManagerService? When was it initialized? What does it do?
  • 2. What is ActivityThread? What is ApplicationThread? The difference between them
  • 3. What is Instrumentation? What is the relationship to ActivityThread?
  • 4. How does ActivityManagerService communicate with Zygote process
  • 5.ActivityRecord ProcessRecord
  • 6. Relationship between ActivityManager and ActivityManagerProxy
  • 7. Hand-written simplified AMS

20. The system starts

  • 1. Android startup process

  • 2. Relationship between SystemServer, ServiceManager, and SystemServiceManager

  • 3. Why not design a Zygote instead of a SystemServer to incubate the application process

  • 4. Why does Zygote use sockets instead of binder for IPC communication

21.App startup & package & install

  • 1. Application startup process
  • 2. Apk composition and Android packaging process
  • 3.Android signature mechanism, how to implement the signature,v2 compared with v1 signature mechanism change
  • 4.APK installation process

22. The serialization

  • 1. What is serialization
  • 2. Why do you need to use serialization and deserialization
  • What are the benefits of serialization
  • The difference between Serializable and Parcelable
  • 5. What is serialVersionUID
  • 6. Why do I need to display a value specifying serialVersionUID?

23.Art & Dalvik and their differences

  • 1.Art & Dalvik and their differences

24. Modularity & componentization

  • 1. What is modularity
  • 2. What is componentization
  • 3. Componentization advantages and solutions
  • 4. Debug components independently
  • 5. Communication between components
  • 6.Aplication is dynamically loaded
  • 7. ARouter principle

25. Hotfixes & plugins

  • 1. Plug-in definitions
  • 2. Advantages of plugins
  • 3. Plug-in framework comparison
  • 4. Plug-in process
  • 5. Plug-in class loading principle
  • 6. Plug-in resource loading principle
  • 7. Plug-in Activity loading principle
  • 8. The difference between hotfixes and plug-ins
  • 9. Hot fix Principle

26.AOP

  • 1. The AOP is what
  • 2. The advantages of AOP
  • 3. The AOP implementations, APT, AspectJ, ASM, epic, hook

27.jectpack

  • 1.Navigation
  • 2.DataBinding
  • 3.Viewmodel
  • 4.livedata
  • 5.liferecycle

28. Open-source frameworks

  • 1.Okhttp source process, thread pool

  • 2.Okhttp interceptor,addInterceptor and addNetworkdInterceptor difference

  • 3.Okhttp responsibility chain mode

  • 4. How to handle the Okhttp cache

  • 5.Okhttp connection pool and socket multiplexing

  • 6. How does Glide bind the life cycle

  • Glide cache mechanism, memory cache, disk cache

  • 8.Glide and Picasso

  • 9. LruCache principle

  • Retrofit source process, dynamic proxy

  • 11.LeakCanary weak reference, source process

  • 12.Eventbus

  • 13.Rxjava

At the end of the article

The above part of the topic is his review during the online looking for a few big factory interview questions. I also analyzed and organized these interview questions into a document, but I did not present them in the article due to the length of the paper. Good memory is not as good as bad writing, always holding a “I should be” mentality to brush the interview questions, in their own brain over a piece, feel the answer, but often a real with the interviewer on the line will be stuck, or suggest that each interview questions to write again, and then to do the extension. When you can write out every interview question logically, there will be no problems in the interview.

Public account: Programmer Meow (focus on Android study notes, interview questions and IT information sharing)