Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Baidu Android development programmers two rounds of interview part of the answer


Jun 02, 2021 Article blog



Baidu Android development programmers two rounds of interview the first part of the answer to the question:


1, MVP mode advantages and disadvantages?


MVP pattern benefits:

  1. Reduce coupling
  2. The division of module responsibilities is obvious
  3. For test-driven development
  4. Code reuse
  5. Hide the data
  6. Code flexibility

MVP mode drawbacks:

Because views are rendered in Presenter, views and Presenters interact too often. I t's also important to understand that if Presenter renders views too much, it tends to make them too closely related to a particular view. Once the view needs to change, presenter needs to change as well


2, how to start an Activity is to start a service?


First define a service, then connect inside the onCreate of the activityy and bindservice or directly startService.


3, talk about Activity, Intent, what is the relationship between Service?


An Activity is usually a separate screen, and each Activity is implemented as a separate class that is inherited from the Activity base class, which displays the user interface made up of view controls and responds to events in view controls.

  • Intent's call is used to switch between schema screens.
  • Intent is a description of what the app wants to do.
  • The two most important parts of the Intent data structure are the data for the action and action, and one action for the action data.

Android Service is code that runs in the background, cannot interact with users, can run in its own processes, or it can run in the context of other application processes. Need to be used by one Activity or other Context object.

Activity jumps to Activity, Activity starts service, and Service opens Activity. Both Intent needs to indicate the intent of the jump, as well as the transmission parameters, and Intent is the carrier of the signal transmission between these components.