In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, the editor will bring you what are the Baidu Android interview questions. The article is rich in content and analyzes and narrates for you from a professional point of view. I hope you can get something after reading this article.
1. Whether the process of Android dvm and Linux and the process of application are the same concept.
DVM refers to the virtual machine of dalivk. Each Android application runs in its own process and has a separate Dalvik virtual machine instance. Each DVM is a process in Linux, so it can be thought of as the same concept.
2. What is the function of the EF file of sim card
The file system of sim card has its own specification, mainly to communicate with mobile phone. Sim itself can have its own operating system. EF is used for storage and communication with mobile phone.
3. What are the types of memory management in embedded operating systems and what are their characteristics?
Page type, paragraph type, paragraph page, using MMU, virtual space and other technologies.
4. What is the embedded real-time operating system? is the Android operating system real-time operating system?
Embedded real-time operating system means that when external events or data are generated, they can be accepted and processed at a fast enough speed, and the results of their processing can control the production process or respond quickly to the processing system within a specified period of time. And control all real-time tasks run harmoniously. Mainly used in industrial control, military equipment,
Aerospace and other fields have stringent requirements on the response time of the system, which requires the use of real-time systems. It can be divided into soft real-time and hard real-time, and android is based on linux kernel, so it belongs to soft real-time.
5. How many byte does the longest short message account for?
70 in Chinese (including punctuation), 160 bytes in English
6. What are the types of animation in android, and what are their characteristics and differences?
There are two kinds, one is Tween animation, and the other is Frame animation. Tween animation, this way of implementation can make the view components move, zoom in, zoom out and produce changes in transparency; another Frame animation, the traditional animation method, through the sequential playback of arranged pictures to achieve, similar to movies.
7. The principle of handler mechanism.
Andriod provides Handler and Looper to satisfy communication between threads. Handler first in, first out principle. The Looper class is used to manage the message exchange (Message Exchange) between objects within a particular thread.
1) Looper: a thread can generate a Looper object that manages the Message Queue (message queue) in this thread.
2) Handler: you can construct a Handler object to communicate with Looper so that push new messages can be sent to Message Queue, or you can receive messages sent by Looper from Message Queue.
3) Message Queue (message queue): used to store messages placed by threads.
4) Thread: UI thread is usually main thread, and Android creates a Message Queue for it when it starts the program.
8. Talk about the principle of mvc mode and its application in android
MVC (Model_view_contraller) Model _ View _ Controller. MVC applications always consist of these three parts. Event (event) causes Controller to change Model or View, or both. Whenever the Controller changes the data or properties of the Models, all dependent View will be updated automatically. Similarly, whenever the Controller changes, the View,View will refresh itself by fetching data from the potential Model.
View redrawing and memory leaks seem to be the questions often asked by interviews.
1. Refresh of View:
Where a refresh is needed, use handle.sendmessage to send a message, and then execute invaliate or postinvaliate in handle's getmessage.
2. GC memory leak
The situation occurs:
1. The cursor of the database is not closed
two。 Cached contentview is not used when constructing adapter
Optimization problem derived from listview-reduce the number of objects that create view, make full use of contentview, and use a static class to optimize the process of dealing with getview.
Use recycle () to free memory when the 3.Bitmap object is not in use
The life cycle of objects in 4.activity is greater than that of activity
Debugging method: DDMS== > HEAPSZIE== > dataobject== > [Total Size]
The life cycle of an Activity
Second, turn Activity into a window: Activity property setting
Third, the Activity of your background is managed by the system.
What about recycling: onSaveInstanceState
Four called and called: our messenger-Intent
The life cycle of an Activity
Like applications on other mobile platforms, the life cycle of Android applications is uniformly controlled, which means that the fate of the applications we write is in the hands of others, and we can't change it, we can only learn and adapt to it.
Let me briefly explain why it is like this: when our mobile phone is running, when an application is running, it is possible to make incoming calls and send text messages, or there is no power, at this time, the program will be interrupted, giving priority to serving the basic functions of the phone. In addition, the system does not allow you to take up too much resources, at least to ensure the phone function, so it may be killed when resources are insufficient. To get to the point, the basic life cycle of Activity is as follows:
Java code
Public class MyActivity extends Activity {protected void onCreate (Bundle savedInstanceState); protected void onStart (); protected void onResume (); protected void onPause (); protected void onStop (); protected void onDestroy ();}
The Activity you write will reload these methods as needed. OnCreate is inevitable. During a normal startup of Activity, the order in which they are called is onCreate-> onStart-> onResume, and when Activity is killed, the order is onPause-> onStop-> onDestroy. This is a complete life cycle, but someone asked, the program is running. Call, what to do with this program? Abort. If a new Activity is full-screen when aborted: onPause- > onStop, onStart- > onResume when resuming. If the Activity interrupting the application is an Activity with Theme of Translucent or Dialog, then it's just onPause and onResume when resuming. Describe in detail what the system is doing and what we should do in these methods:
OnCreate: create an interface here and do some data initialization
OnStart: at this point, users can see and not interact with each other
OnResume: become interactive with the user, (at the top of the activity stack system managing these Activity through the stack, after running the pop-up stack, go back to the previous Activity)
OnPause: at this point, it is visible but not interactive, and the system will stop animation and other things that consume CPU. As we already know from the above description, you should save some of your data here, because at this time your program's priority is lowered and may be withdrawn by the system. The data saved here should be read out in onResume. Note: the time for doing things in this method should be short, because the next activity will not wait until this method is completed before starting.
Onstop: become invisible, overwritten by the next activity
OnDestroy: this is the last method to be called before activity is killed. It may be that the outer class calls the finish method or the system temporarily kills it in order to save space. You can use isFinishing () to judge it. If you have a Progress Dialog rotating in the thread, please cancel it in the onDestroy, otherwise when the thread ends, calling the cancel method of Dialog will throw an exception.
OnPause,onstop, onDestroy, activity may be killed by the system in three states. In order to ensure the correctness of the program, you need to write the persistent layer operation code in onPause () and save all the content edited by the user to the storage medium (usually the database). There are also a lot of problems caused by life cycle changes in actual work, such as your application has a new thread running, and when it is interrupted, you have to maintain that thread, whether to pause or kill or data rollback, right? Because Activity may be killed, it is important to pay attention to the variables and some interface elements used in threads. I usually use Android's message mechanism [Handler,Message] to deal with multithreading and interface interaction. I will talk a little bit about this later. Recently, because these things are already very big, I will share them with you when I clear my mind.
Second, turn Activity into a window: Activity property setting
Let's take it easy. Some people may want to make an application that floats on the phone's main interface, so it's easy to set the theme of Activity and say a word about where to define Activity in AndroidManifest.xml:
Xml code
Android:theme= "@ android:style/Theme.Dialog"
Android:theme= "@ android:style/Theme.Dialog"
This makes your application pop up in the form of a dialog box, or Xml code
Android:theme= "@ android:style/Theme.Translucent"
Android:theme= "@ android:style/Theme.Translucent"
It becomes translucent. [friendly reminder -. -] similar attributes of activity can be seen in the AndroidManifestActivity method of the android.R.styleable class. For an introduction to the attributes of all elements in AndroidManifest.xml, please refer to this class android.R.styleable.
The above is the name of the attribute, and what the value is in android.R.style
As you can see, for example, this "@ android:style/Theme.Dialog" corresponds to android.R.style.Theme_Dialog, ('_ 'instead of'.'
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.