Android Interview Essentials

Source: Internet
Author: User

What is the purpose of the EF file for SIM cards? All the files in the SIM card are organized by tree:
Master file--the master file has only the file header, which holds the control and management information of the entire SIM card.
Dedicated files df (dedicated file)--also has only one file header, which contains the entire directory of Management control information, dedicated files equivalent to a directory root.
Basic Files 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 m card only the basic file has a file body, Only basic files are used to store data.
What is the maximum number of bytes in a text message?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 a message sent by Looper out of 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 the abbreviation for Model,view,controller, MVC contains three parts:
Model object: Is the main part of the application, and all business logic should be written on that layer.
View object: Is the part of the application that is responsible for building the user interface. It is also the only layer that the user can see in the entire MVC architecture, receiving input from the user and displaying processing results.
Controller object: is based on the user's input, control the user interface data display and update model object state of the part of the controller more important a navigation function, want to use the user to start the relevant events, to M oh got processing. The specific embodiment of MVC in Android is as follows:
1) View layer: The general use of XML file interface description, the use of the time can be very convenient to introduce, of course, how you learn more about Android, you can think of Android can also use javascript+ HTML and so on as the view layer, of course, there is a need for the communication between Java and JavaScript, fortunately, Android provides a very convenient communication between them implementation.
2) control layer (Controller): The task of Android control layer usually falls on the shoulders of many acitvity, this phrase also implies do not write code in acitivity, to through activity delivery model business Logic layer processing, Another reason for this is that the response time of Acitivity in Android is 5s, and if time-consuming operations are put here, the program is easily recycled.
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 turn activity into a window?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 runs, either actively or passively runs another new activity B at this time a will execute
public void Onsaveinstancestate (Bundle outstate) {    super.onsaveinstancestate (outstate);    Outstate.putlong ("id", 123456);}
B After completion will come to find a, this time there are two cases, one is a is recycled, one is not recycled, was returned A must recall the OnCreate () method, different from the direct start is this back OnCreate () is the parameterSavedinstancestate, 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 quit a application that has called multiple activity? for a single activity application, the exit is simple, just finish ().
Of course, you can also use KillProcess () and System.exit () methods.

How android data is stored 1, the use of sharedpreferences storage data;
2, file storage data;
3, SQLite database storage data;
4, the use of contentprovider storage data;
5 , network storage data;
Android's Common layoutlinear/relative/absolute/grid/table/frame layout
multi-screen adaptation of AndroidA. Define the screen types supported by your program in manifest and the corresponding code is as follows:
<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, if you need support for a screen of size large, you need to create a new folder in the Res directory layout-large/and provide layout. Of course, alsoThe res directory can be established in the Layout-port and Layout-land two directories, which are placed in vertical screen and horizontal screen two layout files to adapt to the vertical screen screen automatically 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 folder drawable-ldpi/, and put in the appropriate size of the picture. Accordingly, the medium corresponds to drawable-mdpi/,high corresponding to Drawable-hdpi/,extra high corresponding to 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 where your picture pixel size is 48x48, the low-density screen should have a picture size of 36x36, and a high of 72x72,extra for 96x96.
How does 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 similar way to tables in a database. Content providers stores and retrieves data, which allows all applications to access, which is 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 are there to register a broadcast?Static Registration: resident type, which accounts for large resources Dynamic Registration: High priority, broadcast following program life cycle
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: applications should periodically connect to the server and query for new messages to arrive, and 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 difficult to find a free gateway to send text messages Persistent Connection : Mainly Socket communication, this solves the performance problem, but the power consumption problem still can not solve
how the network communicates
Tcp/url (URLConnection)/http (HttpClient)/webview/webservice
activity startup mode1. Standard
mode startup mode, activity is created each time the activity is activated and placed in the task stack.

2. Singletop
If there is an instance of the activity at the top of the task, reuse the instance, and the user creates a new instance and puts it on top of the stack. (even if the activity real

3. Singletask
on it will be removed from the stack. If the instance does not exist in the stack, a new instance is created to be put 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 in a stack, any where the application is re-activated will reuse the instance in that stack, and the effect is equivalent to sharing an application with multiple applications. Whoever activates the activity goes into the same in one app.
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 C + + dynamic library and to automatically play so and Java applications as APK packages.
The NDK integrates a cross compiler and provides the difference between the corresponding MK file and the isolated CPU, platform, and so on, so developers can simply modify the Mk file to create a
describe Android's system architecture
Android system architecture from bottom to top for Linux kernel layer, runtime, application framework layer, and application tier
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 libraries, such as WebKit, which is responsible for the operation of the Android Web browser, such as the standard C function library libc, OpenSSL, SQLite and so on, of course, including support game development 2DSGL and 3dopengles, Multimedia has mediaframework framework to support a variety of audio-visual and graphics file playback and display, such as MPEG4, H. V, MP3, AAC, Numerous multimedia file formats such as AMR, JPG, and PNG. 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 rapid development.

Applications: This layer is the Java application layer, Android built-in GoogleMaps, e-mail, instant messaging tools, browsers, MP3 players, etc. in this layer, Java developers developed programs are also in this layer, 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 allow interaction between activity and service at any time, so the mechanism in Android is only suitable for communication between activity and service, similar to the remote method invocation, similar to the C/S mode access. 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?
You can use JNI interfaces

the difference between DDMS and TraceView?
DDMS is a program execution viewer, where you can see information such as threads and stacks, and TraceView is a program Performance analyzer

What are the types of animations in Android, and what are their characteristics and differences?
  Two kinds, one is tween animation, and another is frame animation. Tween animations, which enable the view component to move, zoom in, zoom out, and create transparency, another frame animation, a traditional animation method, is implemented by sequential playback of 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 runs in its own process and has a separate instance of the Dalvik virtual machine. And 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, 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 the processing can be within the specified time to control the production process or to respond quickly to the processing system, and control all real-time tasks coordinated operation of the embedded operating system. Mainly used in industrial control, military equipment, aerospace and other areas of the system response time has stringent requirements, which 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, and therefore belongs to soft real-time.

Life cycle of activity
like other mobile platform applications, the life cycle of an Android application is controlled in a unified way, meaning that the application we write is in the hands of someone else (System), and we can't change it, we can only learn and adapt to it. Briefly explain why this is the case: our mobile phone in the running of an application, it is possible to call incoming text messages, 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 allow you to occupy too much resources, at least to ensure that the telephone function bar, So when resources are low, it's possible to get killed.
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 running to call, this program do? Abort the chant, if the abort when a new activity is full screen then: Onpause->onstop, When recovering onstart->onresume, if interrupting this application is a theme for translucent or dialog activity then just OnPause, the time to restore Onresume.

Explain in detail what the system is doing and what we should do in these methods:

OnCreate: Create the interface here and 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, run out of pop-up stack, then go 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 above description already know, should be saved hereSome of your data, because at this time your program's priority is reduced and may be withdrawn by the system. The data that is stored here should be in

Read it in the Onresume, note: This method takes a short time, because the next activity does not wait until this method is completed to start

OnStop: becomes invisible and is 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 kill, can use isfinishing () to judge it, if you have a progress dialog in the thread to turn, please put him in the OnDestroy cancelOff, otherwise the Cancel method that calls dialog will throw an exception when the thread ends.

Onpause,onstop, OnDestroy, in three states, activity can be killed by the system in order to ensure the correctness of the program, you have to be in the OnPause ()Write the code for the persistent layer operation to save the user's edits to the storage media (typically the database). In the actual work, because of the change of life cycle,There are a lot of problems, such as your application has a new thread running, it is interrupted, you have to maintain that thread, whether it is paused or killedIt's data rollback, isn't it? Because 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.