Android interview questions, android interview

Source: Internet
Author: User

Android interview questions, android interview
1. How to Improve the sliding efficiency of ListView
2. Let's talk about the architecture of the project package (networking, parsing, activity, database ).
3. how to load a large number of images (including small images and big charts), how to reduce the number of connections to the server at a time, and how to cache images,
4. Relationship between onInterceptTouchEvent () and onTouchEvent ()
5. How to calculate the height of a view in oncreate (adjust the measurement of the view and then getHeight)
6. Relationship between MessageQueue, logoff, and handler (important)
7. The android widget statistics are statistics on the number of times started from the widget.
8. How to Find the top five largest numbers in a large number of arrays (nlog5's complexity is sorted by a heap of five elements)
9. Differences between final, finalize, and finally
10. How to Write a thread pool (Key Point)? When the number of thread pools in the pool is full, what should I do with the threads outside (using the buffer pool), and how the thread pool works? synchronization Principle
11. Thread yield, sleep (do not release the lock), wait (release the lock, object-level)
12. What is the difference between static variables and dynamic variables stored in java?
13. java deep copy (important)
14. The form of android tasks (singletask, singtop, and so on, to find out their form)
15. How to Implement listView pull-down refresh
16. The onFling () implementation principle of Gallery. Rewrite the onCount () after Gallery.
17. Start and destroy android services (important)
18. java supports multithreading in several ways
19. How to Implement database indexes (B-tree)
20. expressions such as soft references and virtual references in java)
21. How can I implement garbage collection in java)
22. How to customize a View onMeasure, onLayout, and the call order
23. How to customize attributes (to be written)
24. android inter-process communication
25. What is the difference between getWidth () and getHeight () of an image in BitmapFactory. decode () sdcard at different resolutions?
26. Let you write an Internet connection on the spot (for your url, use httpGet to write)
27. Differences between cmwap, cmnet, ctwap, and ctnet
28. How to Implement sliding between the left and right of the android scrollview (there is a scroroller attribute, which can be scroroller. startScroll)
29. How does android achieve sliding between the left and right charts)
30. activity lifecycle (important)
31android supports several types of animations, as well as various forms of Animations (Tween animation and Frame Animation. Tween animation, which allows view components to move, zoom in, zoom out, and change transparency. Another Frame Animation, the traditional animation method, it is achieved through sequential playback of arranged images, similar to movies. )
32. How to Write gni?
33. How does android transmit values, especially objects?
34. How can I make the activity pop up like a dialog box?
35. How to Write a contentProvider




The answer to inter-process communication:
What is the full name of IDL? How to work? What types of data can be processed?
The full name of AIDL is Android Interface Define Language.
When process A is going to call the service in process B and implement communication, we usually operate through AIDL.
Project:
First, create a RemoteService. aidl file in the net. blogjava. mobile. aidlservice package. In this file, you can customize an interface that contains the get method. The ADT plug-in will automatically generate a RemoteService. java file under the gen Directory, which contains an internal class named RemoteService. stub, which contains the get method of the aidl file interface.
Description 1: the location of the aidl file is not fixed and can be arbitrary.
Then define your own MyService class. In the MyService class, define an internal class to inherit the internal class RemoteService. stub and implement the get method. The onBind method returns the object of this internal class. The system will automatically encapsulate this object as an IBinder object and pass it to its caller.
Configure the MyService class in the AndroidManifest. xml file. The Code is as follows:
<! -- Register a service -->
<Service android: name = ". MyService">
<Intent-filter>
<! -- Specify the ID of the AIDL service to be called -->
<Action android: name = "net. blogjava. mobile. aidlservice. RemoteService"/>
</Intent-filter>
</Service>
Why do you need to specify the ID of the AIDL service to be called, that is, to tell the outside world that the MyService class can be accessed by other processes, as long as other processes know this ID, it is precisely with this ID, project B can find Project A to implement communication.
Note: AIDL does not require permissions.
Project B:
First, we need to copy the RemoteService. java file generated in Project A to Project B and bind the aidl service to the bindService method.
Binding the AIDL Service uses the RemoteService ID as the intent action parameter.
NOTE: If we put the RemoteService. aidl file in a bag separately, copy the package under the gen directory to Project B. If we set the RemoteService. aidl files are stored together with other classes, so we need to create corresponding packages in Project B to ensure RmoteService. the java file registration is correct. We cannot modify RemoteService. java files
BindService (new Inten ("net. blogjava. mobile. aidlservice. RemoteService"), serviceConnection, Context. BIND_AUTO_CREATE );
The service parameter in the onServiceConnected (ComponentName, IBinder service) method of ServiceConnection is the object that inherits the internal class of RemoteService. stub in MyService class of Project.






The Android Application structure is:
Linux Kernel (Linux Kernel), Libraries (system Runtime library or c/c ++ core library), Application
Framework (Development Framework Package), Applications (core Applications)


In android, briefly describe the jni call process. (8 points)
1) install and download Cygwin and Android NDK
2) Design of the jni interface in the ndk Project
3) use C/C ++ to implement local methods
4) JNI generates the dynamic link library. so file
5) copy the dynamic link library to the java project, call it in the java project, and run the java project.




Custom Attributes:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Resources>
<Declare-styleable name = "myView">
<Attr name = "textColor" format = "color"/>
<Attr name = "textSize" format = "dimension"/>
</Declare-styleable>
</Resources>
Package cn.com. flyfot. attrs;
Public MyView (Context context, AttributeSet attr ){
Super (context, attr );
MPaint = new Paint ();
// Get Custom Attributes
TypedArray a = context. obtainStyledAttributes (attr, R. styleable. myView );
// Obtain the dimension attribute value. The default size is 30.
Float textSize = a. getDimension (R. styleable. myView_textSize, 30 );
// Obtain the color attribute value. The default color is 0x990000FF.
Int textColor = a. getColor (R. styleable. myView_textColor, 0x990000FF );
// Set the paint brush size and color
MPaint. setTextSize (textSize );
MPaint. setColor (textColor );
// Cache attributes, which can be left unspecified, mainly to improve efficiency
A. recycle ();
}


<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Xmlns: flyfot = "http://schemas.android.com/apk/res/cn.com.flyfot.attrs"
Android: orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
>
<! -- Set Properties -->
<Cn.com. flyfot. attrs. MyView
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Flyfot: textSize = "120px"
Flyfot: textColor = "# ABCDEFEF"
/>
 
<! --
Note the introduction of namespace: xmlns: flyfot = "http://schemas.android.com/apk/res/cn.com.flyfot.attrs"
-->

</LinearLayout>
Some difficult questions about android

Do you want to take an interview, or do you want to consolidate your basic skills ??
In fact, most android interview questions are not too difficult...

ANDROID written test interview questions

Check for only a few questions

Related Article

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.