Android Interview Essentials

Source: Internet
Author: User
Tags sqlite database

What is the purpose of the EF file for SIM cards?

sim all files in the card are organized by tree:
Master file--The main file has only a file header, which holds the control and management information for the entire SIM card
dedicated files df (dedicated file)-there is only one file header, which holds the entire folder of administrative control information, dedicated files equivalent to a folder root.
basic file ef (elementary file)--both the file header and the file body, the file header holds the location and control information of the file, the file body holds the real data, the entire si< Span style= "White-space:pre" > The m card has only basic files in the file body, and only basic files are used to hold the data.
What is the maximum length of a text message? b Yte? Chinese 70 (including punctuation), English 160 bytes
How does the handler mechanism work?

Andriod provides Handler and Looper to meet the communication between threads. Handler first-out principle.

The Looper class is used to manage the exchange of messages (message exchange) between objects within a particular thread.
1) Looper: A thread can produce a Looper object that manages the message queue of this line thread
2) Handler: You can construct a Handler object to communicate with Looper in order to push a new message into the message queue, or to receive messages sent by Looper from the message queue.


3) Message queue (Message Queuing): Used to hold messages placed by the thread.
4) Thread: The UI thread is usually the main thread, and the Android launcher will create a message Queue for it.
How does the MVC pattern work in Android apps? Objective: To reduce the coupling and reuse of the components MVC is an acronym for Model,view,controller, and MVC consists of three parts:
Model object: Is the body part of the application. All of the business logic should be written on that layer.


View object: Is the part of the application that is responsible for generating the user interface. is also the only layer that users can see throughout the MVC architecture. Receives the user's input, displays the processing result.
Controller object: The part that controls user interface data display and updates the state of the model object according to the user's input. The controller is more important a navigation function, want to use the user to start related events, to M oh got processing.the detailed embodiment of MVC in Android is as follows:
1) View layer: The general use of XML files for the description of the interface, when used can be easily introduced. Of course, how much more you know about Android, you will be able to think of Android can also use javascript+html and other ways as the view layer, of course, there is a need for Java and JavaScript communication between, fortunately. Android provides a convenient communication implementation between them.
2) control layer (Controller): The task of Android's control layer usually falls on the shoulders of many acitvity. This also implies that you do not write code in acitivity, to be processed by the activity delivery model business logic layer, another reason is that the acitivity response time in Android is 5s, assuming time-consuming operations are placed here. The program is very easy to be recycled out.
3) Model: the operation of the database, the operation of the network, etc. should be processed in the model, of course, business calculations and other operations must be placed in the layer.
How do I make activity into a form?

Define activity's properties in Androidmanifest.xml: Android:theme= "@android: Style/theme.dialog"
what happens when the activity in the background is collected by the system? When an activity A in your program is in execution. Active or passive execution there is a new activity B at this time a will execute

public void Onsaveinstancestate (Bundle outstate) {    super.onsaveinstancestate (outstate);    Outstate.putlong ("id", 123456);}
B After the end will come to find a, this time there are two cases, one is a is recycled, one is not recycled. Be returnedthe received a will again call the OnCreate () method, different from the direct start is this time OnCreate () is with the number of parametersSavedinstancestate, not to be retracted is still onresume just fine.
if (savedinstancestate! = null) {     Long id = savedinstancestate.getlong ("id");}

the role of intent
How do I exit the activity? How do I safely exit a application that has called multiple activity?For single activity applications, exit is very easy and direct finish () is available.


Of course, it is also possible to use KillProcess () and System.exit () as a solution.

How android data is stored 1. Use Sharedpreferences to store data.
2, file storage data.
3, SQLite database storage data;
4, the use of contentprovider storage data;
5 , network storage data;
the layout that Android often useslinear/relative/absolute/grid/table/frame layout
multi-screen adaptation of AndroidA. In manifest, define the screen types that your program supports, such as the following code:
<supports-screens android:resizeable=["true" | "False"]
Android:smallscreens=["true" | "false"]//whether small screen support
Android:normalscreens=["true" | "false"]//whether to support the middle screen
Android:largescreens=["true" | "false"]//whether to support large screen
Android:xlargescreens=["true" | "false"]//whether to support the super-large screen
Android:anydensity=["true" | "false"]//support multiple screens with different densities
android:requiressmallestwidthdp= "Integer"
android:compatiblewidthlimitdp= "Integer"
android:largestwidthlimitdp= "integer"/>

B. Provide different layout for different sizes of screens.
For example. Suppose you need to support a screen of size large. You need to create a new folder under the Res folder layout-large/and provide layout. Of course. Alsobe able to set up Layout-port and Layout-land two folders under the Res folder, with two layout files, vertical screen and horizontal screen respectively. To adapt to the horizontal screen vertical screen own active switch.



C. provide different images for different densities of screens.
Should try to use a point 9 format of the picture, if you want to the low density of the screen to provide the appropriate picture, you need to create a new directory drawable-ldpi/. and put in a suitable size picture. Accordingly, medium corresponding drawable-mdpi/,high corresponding Drawable-hdpi/,extra high corresponding drawable-xhdpi/.
The size of the picture is determined: the Low:medium:high:extra high ratio is 3:4:6:8.

For example. For medium density (medium) screens your picture pixel size is 48x48, then the image size of the low density screen should be 36x36. The height is 72x72,extra high for 96x96.
How does the contentprovider achieve data sharing? A program can completely expose its own data by implementing a content provider abstraction interface, and content providers exposes data in a way similar to a table in a database. Content providers stores and retrieves data, allowing all applications to access it. This is also the only way to share data between applications.


There are 2 ways to make your application's data public: Create a content provider that belongs to you or add your data to an existing content provider, The premise is that you have the same data type and have permission to write to content provider.


How many ways do you have to register a broadcast? Static Register: resident type, the proportion of resources is relatively large Dynamic Register: Higher priority, life cycle of broadcast trailing programs
What are the ways to exchange data between the front and back tables, including text and pictures?


What are the methods for pushing messages?

polling: The application should periodically connect with the server and query for new messages arriving. You must implement your own communication with the server SMS:(by sending a text message and parsing the message content to get server-side instructions), the problem is that it is very difficult to find a free gateway to send SMS Persistent Connection : Mainly Socket communication, this overcomes the performance problem. But the problem of power consumption still hasn't been solved.
how the network communicates
Tcp/url (URLConnection)/http (HttpClient)/webview/webservice
activity startup mode 1. Standard
mode startup mode. The activity is created each time the activity is activated and placed in the task stack.

2. Singletop
Assuming that an instance of the activity exists at the top of the task, the instance is reused, and the new instance is created and placed on top of the stack, even if the activity case already exists in the stack. Just not at the top of the stack. will create an instance).

3. Singletask
If you already have an instance of the activity in the stack, reuse that instance (the Onnewintent () of the instance is invoked). When reused, the instance is returned to the top of the stack, so the instances above it will be removed from the stack.

Assuming that the instance does not exist in the stack, a new instance is created into the stack.

4. SingleInstance
Create the activity instance in a new stack and have multiple apps share the activity instance in the stack.

Once an instance of the activity of the schema is present on a stack. Any application that activates the activity will reuse the instance in that stack, which is equivalent to sharing an app with multiple applications, regardless of who activates the activity into the same application.
What is the NDK?
The NDK is a collection of some column tools,
The NDK provides a range of tools to help developers quickly develop a dynamic library of C/D + +. And can take the initiative to make so and Java applications into APK package.


The NDK integrates a cross compiler and provides the difference between the corresponding MK file and the isolated CPU, platform, and so on. Developers simply need to change the Mk file to create a
Describe the system architecture of Android
Android system architecture from bottom to top for Linux kernel layer, execution Library, application framework layer, and application layer
Linuxkernel: Responsible for the hardware driver, network, power, system security, memory management and other functions.

Libraries and androidruntime:libraries: That is, the C + + function library section, most of which are open source function libraries. For example WebKit, the library is responsible for the implementation of the Android Web browser, such as the standard C function library libc, OpenSSL, SQLite, etc., of course, also includes support game development 2DSGL and 3dopengles, There is a mediaframework framework in multimedia to support the playback and display of various audio-visual and graphic files, such as MPEG4, H, MP3, AAC, AMR, JPG and PNG, and many other multimedia file formats. The runtime of Android is responsible for interpreting and executing bytecode in the generated Dalvik format.

Applicationframework (Application software architecture). Java application developers are primarily using this layer of packaged APIs for high-speed development.



applications: This layer is the Java application layer, the Android built-in GoogleMaps, e-mail, instant messaging tools, browsers, MP3 players, etc. in this layer. Programs developed by Java Developers are also at this level. And the built-in application has an equal position, can call the built-in application, can also replace the built-in application.

talk about the IPC mechanism of Android
IPC is the abbreviation for internal process communication and is a resource for sharing named pipes. The IPC mechanism in Android is designed to enable interaction between activity and service at any time, so this mechanism is in Android. Only applies to the communication between activity and service. Similar to remote method calls. An interview similar to the C/S mode. Define the IPC interface by defining the Aidl interface file. The Servier end implements the IPC interface, and the client side invokes the IPC interface local agent.

How do I reference the local language in Java?
Ability to use JNI interfaces

The difference between DDMS and TraceView?
DDMS is a program that runs the viewer. In which information such as threads and stacks can be seen, TraceView is a program Performance analyzer

What are the types of animations in Android? What are their characteristics and differences?
  Two kinds, one is tween animation, the other is frame animation. Tween animations, which enable the view components to move, zoom in, zoom out, and create a change in transparency, another frame animation, a traditional animation method, is achieved by sequentially playing a well-arranged picture, similar to a movie.


Android DVM processes and Linux processes, whether the application process is the same concept
   DVM refers to DALIVK virtual machines. Each Android application executes in its own process and has a separate instance of the Dalvik virtual machine. Each DVM is a process in Linux, so it can be thought of as the same concept.

What kinds of embedded operating system memory management, what are the characteristics of each

   page style. Segment, section page, using the MMU, virtual space and other technologies

What is embedded real-time operating system, the Android operating system belongs to the real-time operating system?


  Embedded real-time operating system refers to when the external events or data generated, can be accepted and fast enough to be processed, the results of its processing can be within the specified time to control the production process or the processing system to make high-speed response. and control all real-time tasks to coordinate the implementation of the embedded operating system. Mainly used in industrial control, military equipment, aerospace and other areas of the system response time has stringent requirements, this requires the use of real-time systems. Can be divided into soft real-time and hard real-time two kinds. And Android is based on the Linux kernel. Therefore belongs to soft real-time.



Life cycle of activity
Like apps from other mobile platforms, Android apps have a unified life cycle. That is to say, we write the application of the fate of the people (System) in the hand, we can not change it, just learn and adapt to it. Briefly explain why this is the case: when we run an application on our phone, it is possible to call in and send in a text message. Or no electricity, this time the program will be interrupted, priority to the basic function of the service phone. In addition, the system does not agree that you occupy too much resources. At the very least, make sure you have a phone function, so you can get rid of it when resources are low.
During the normal start of an activity, they were called in the order of OnCreate, OnStart, Onresume, when the activity was killed, OnPause, OnStop OnDestroy, this is a complete life cycle. But someone asked, the program is executing the phone, this program do?

Abort the chant, assuming the abort when a new activity is full screen then: Onpause->onstop. Recovery time Onstart->onresume, assuming that the application is interrupted by a theme for translucent or dialog activity then only OnPause, restore time onresume.

Give a detailed description of what the system is doing and what we should do in these few ways:

OnCreate: Create the interface here. Do some initialization work on the data

OnStart: To this step becomes user visible non-interactive

Onresume: To become interactive with the user, (in the activity stack system through the way of the stack to manage these

Top of activity, execution of pop-up stack, back to previous activity)

OnPause: To this step is visible but not interactive, the system will stop the animation and other CPU-consuming things from the description described above have been known, should be saved hereSome of your data, because of this time your program's priority is reduced, it may be recalled by the system. Save the data here. should be in

Read it in the Onresume. Note: This is a short time to do things, because the next activity will not wait until this method is complete.

OnStop: becomes invisible. Covered by the next activity.

OnDestroy: This is the last method that was called before the activity was killed, perhaps the outer class called the Finish method or the system to save space to temporarilyThe time of the sexual killing. Be able to infer it with isfinishing (), assuming you have a progress dialog rotating in the thread. Please cancel him in the OnDestroy.Off, or when the thread ends. Calling dialog's Cancel method throws an exception.

Onpause,onstop, OnDestroy. In three states, the activity is likely to be killed by the system. In order to ensure the correctness of the program, you have to be in OnPause ()Write the code for the persistent layer operation. Save the user edits to the storage media (typically a database). Actual work due to changes in life cycleThere are also a lot of problems, for example, your application is running with a new thread. At this time of interruption, you have to maintain the thread, whether it is suspended or killed orIs data rollback. Yes? As the activity may be killed, the variables used in the thread and some of the interface elements must be noticed, usually usingAndroid's messaging mechanism [handler,message] to handle multithreading and interface interaction issues.



Android Interview Essentials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.