20 25K + Android engineer interview will face questions asked

The 25K is generally considered a watershed in the development of Android. Did not point the real thing, really can not get 25

This article explains:

  • Why should we choose to leave

  • Interview will face questions asked

  • How to choose the favorite company

A. Why do we choose to leave

  • Wages can not keep up consumption

  • Go to work can not find the feeling of belonging and a sense of accomplishment, to go to work and feel the same jail

  • The company did not develop in space

Two .25K + Android engineers will face questions asked

1.APK installation
application installation involves several directories as follows:

  • system / app: system comes with applications that can not be deleted

  • data / app: user installation directory, you have delete permissions. When you install the apk file to this directory copy

  • data / data: storing data for an application

  • data / dalvik-cache: mounting apk dex file in the next dalvik-cache directory

APK installation package to copy the data / app directory, unzip and scan the installation package, the dex file (the Dalvik byte code) is stored dalvik-cache directory, and creating the corresponding application data in the directory data / data directory

Difference 2.invalidate () and postInvalidate () of

invalidate () is used to refresh View, the work must be carried out in the UI thread. For example, when modifying a view of the display, call invalidate () to see the screen and re-drawn.
postInvalidate () is called in the worker thread.

3.Parcelable and the difference between Serializable

Parcelable performance better than Serializable, small in terms of memory overhead, it is recommended to use Parcelable when data transfer between memory, such as the transmission of data between activity, while Serializable can easily save data persistence technology, so you need to save or transmit data network select Serializable, because different versions of android Parcelable may be different, it is not recommended Parcelable for data persistence.

Serializable sequence of static variables are not saved, Transient key may be used for some fields are not serialized, can also cover writeObject, readObject method to implement custom serialization.

4.Android there are several options to transfer data across processes

  • Binder

  • Socket/LocalSocket

  • Shared memory

5. anonymous shared memory usage scenarios

In the Android system, it provides a unique anonymous shared memory subsystem Ashmem (Anonymous Shared Memory), it is implemented in the kernel space in the form of a driver. It has two characteristics, one is able to assist memory management system to effectively manage memory blocks are no longer used, and second memory sharing between it be achieved through inter-process communication mechanism Binder process.

ashmem and Android is like Binder re-engage in their own set of things, but to use Linux's tmpfs file system. tmpfs is a possible high-speed RAM or SWAP file system, then you can take it to achieve memory sharing between different processes.

And processes the general idea is:

  • Proc A Create a shared area by tmpfs, to give FD (file descriptor) in this region

  • Proc A mmap memory area to present a process for sharing data on fd

  • Proc A by some means and shift to the fd Proc B

  • Proc B received in the same region of fd mmap similar to the present process

  • Then A, B mmap to read in this process memory write, can see the other side

In fact, the core point is to create a shared area, then these two processes simultaneously mmap piece of this area to process, and then read and write the same as the memory of this process. Dir 3 steps here to explain why and shift fd, because in linux fd but this process is unique, open a file in Proc A obtained a fd, but put directly into the open fd in Proc B, Proc B can not be used directly. But the file is unique, that is to say a file (file) can be opened multiple times, each time there is an open fd (file descriptor), so for the same file, the need for some kind of transformation, in the Proc A fd Proc B is converted to fd. Proc B to this by fd mmap the same shared memory file.

Usage scenarios: inter-process large amounts of data transmission

The principle 6.ContentProvider

ContentProvider has the following two characteristics:

  • Package: data package, providing a unified interface, users do not have to care about these data is requested in the DB, XML, Preferences, or the network. When a project needs to be changed data sources, use our place completely without modification.

  • Provide a way to share data across processes.

Content Provider component in the transmission of data between applications is done based on anonymous shared memory mechanism. The main invocation:

① by ContentResolver first find the corresponding ContentProvider given Uri, and returns the corresponding BinderProxy

  • If the Provider has not been used by the calling process:

    • ActivityManagerService obtained by ServiceManager find activity service corresponds BinderProxy

    • The method of transmitting transcat call BinderProxy GET_CONTENT_PROVIDER_TRANSACTION command, corresponding to a ContentProvider BinderProxy obtained.

  • If the Provider calling process has been used, the calling process will be used to retain provider of HashMap. At this point the query directly from this table that was.

② call BinderProxy the query ()

7. How to use ContentProvider batch operation?

Batch operation is usually performed data we will use the "transaction", but how does it work ContentProvider batch? ContentProviderOperation create an array of objects, and then use ContentResolver.applyBatch () will dispatch it to the content provider. You need to authorize content provider passed to this method, rather than specific content URI. This allows each ContentProviderOperation object in the array can be applied to other tables. Call ContentResolver.applyBatch () returns the resulting array.

We can also observe the data by ContentObserver:

  • We create specific ContentObserver derived classes must override onChange () method to handle the callback function after realization

  • Using context.getContentResolover () obtained ContentResolove object then calls registerContentObserver () method to register the content viewer, Uri register specified instance of a derived class ContentObserver, when given Uri is changed, the correction to deal with the object instance.

  • Because ContentObserver life cycle is not synchronized to the Activity and Service, etc. Therefore, when not needed, you need to manually call unregisterContentObserver () to cancel the registration.

8. broadcast what the problem is not deregistered after registration? (Memory leaks)

We can register in two ways BroadcastReceiver, first, by the code Activity startup dynamic registration, second is to use <receiver> tag statically registered in the AndroidManifest.xml file.

  • For the first method, we need to develop a good habit: When Activity entering stop or destroy the state's method using unregisterReceiver registered BroadcastReceiver written off.

  • To register for the <receiver> tag, then the instance of the object will be destroyed at any time after onReceive is called.

9. The difference between animation property (Property Animation) and tweens (Tween Animation) of

10.BrocastReceive inside Can perform time-consuming operation?

11.Android optimization tools: TraceView and Systrace

The difference 12.Dalvik with ART?

13.Android dynamic rights?

How 14.ViewPager judge slide around?

And override onPageScrolled achieve OnPageChangeListener method, it is determined by the parameters.

15.ListView与RecyclerView

16. Describe App Android phone boot process and start the process?
Android phone boot process

When we boot, first boot the Linux kernel, the Linux kernel first start the init process, which will go to read the configuration file system\core\rootdir\init.rcconfiguration file, this file is configured with the Android system the first process Zygote process.

Zygote process started -> Create AppRuntime (Android Runtime Environment) -> Start Virtual Machine -> registered JNI method in a virtual machine -> initialization process communication using Socket (for receiving the request AMS) -> Start system service process -> General information initialization zone, keyboard layout, etc. -> start Binder thread pool -> initialize system services (including PMS, AMS, etc.) -> startup Launcher

App startup



  • Start the application is invoked from other applications startActivity began. AMS through a proxy request to start Activity.

  • AMS creation process and enter the main entrance of ActivityThread. In the main entrance, the main thread initialization and loop it. The main thread initialization, mainly instantiated ActivityThread ApplicationThread, as well as the creation and MainLooper. ActivityThread and ApplicationThread examples for communicating with the AMS process.

  • Application process will be instantiated ApplicationThread, Binder passed to the AMS, AMS so you can access the application process through a proxy.

  • AMS through a proxy, a request to start Activity. ApplicationThread notify the main thread to perform the request. Then, ActivityThread start execution of Activity.

  • Activity includes startup, Activity instantiated, Application instantiation, and start the process of Activity: create, start, resume.

We can see the entrance prior to the Application Activity is actually instantiated, just like onCreate process, prior to the Activity process. The method additionally required scheduleLaunchActivity, in ApplicationThreaad the corresponding AMS Management Activity lifecycle are to scheduleXXXActivity, ApplicationThread in Binder thread, it will send a message to the main thread, ActivityThread of Handler will call the appropriate handleXXXActivity method, and then executes performXXXActivity method, Activity method eventually calls the onXXX

Difference 17.Asset res directory and directory

18.Application in multi-process calls repeatedly onCreate () Why?
When the multi-process, such as the following Service Configuration:


<service
    android:name=".MyService"
    android:enabled="true"
    android:exported="false"
    android:process=":remote" />

android: process attribute: role is the name appended to the standard process name of your bag are running as the new process name.

This configuration will call onCreate () twice

The difference 19.FragmentPagerAdapter and FragmentStateAdapter?

20.SurfaceView && View && GLSurfaceView

More topics answer, please end receive text

III. How to choose the favorite company

Many offer, how to choose?
Large, small factory selected company money, almost all of overtime selected few plants elections, are more overtime, the election more money.

As long as the technology in hand, where all food to eat, do not bare resigned last

There is no small like-minded partners in progress? Said front face of those questions answer?

This put together a set of learning materials engineer for Android file sharing "Android architecture video + BAT interview topic PDF + study notes"



If you feel this article help you, please submit a praise it Thank you ~


Guess you like

Origin blog.51cto.com/14048760/2471206