Android

1. What kinds of animations are available on Android? What are their characteristics and differences?

B. Tween animation: allows view components to move, zoom in and out, as well as create changes in transparency

2. Talk about the principle of MVC pattern and its application in Android:

3. Turn your Activity into a window?

Set the Activity property, referenced in androidmanifest.xml

4. Five ways to store Data on Android:

SharedPreferences Store Data: Android provides a mechanism for storing simple configuration information, such as login account and password. It uses Map data structures to store data as key-value pairs. Under /data/data//shares_prefs in File Explorer in DDMS. Disadvantages of using SharedPreferences: It can only be used within the same package.

OpenFilePut () and openFileOutput() methods are provided to read/write files on the device:


String s = "log";
FileInputStream fi = openFileInput(s);
FileOutputStream fo = openFileOutput(s,Context.MODE_PRIVATE);

Copy the code

SQLite database stores data: SQLite is a lightweight embedded database engine that uses very little memory for very good performance, creating a database directly from SQLiteDatabase objects. Or inherit the SQLiteOpenHelper class to encapsulate the logic used to create and update the database

Network storage data: You need to interact with Android network packets

ContentProvider stores the data

5. Five common Android layouts:

FrameLayout LinearLayout AbsoluteLayout TableLayout

6. What can cause Force Close? How to avoid it? Can you catch the exception that caused it?

A. The program is abnormal, for example, NullPointer b. Avoid: Write more robust code c. Check the exception information in logcat

7. Activity lifecycle when switching between vertical and horizontal screens?

A. When android:configChanges is not set for the Activity, each lifecycle will be re-called when the screen is cut. By default, the current Activity will be destroyed and then reloaded. Once for landscape and twice for portrait.

B. If you set Actiity’s Android :configChanges=”orientaion”, each life cycle will be called again and the vertical and horizontal screen cuts will only be performed once.

C. set the Activity of the android: configChanges = “orientation” | KeyboardHidden | scrennSize “, cut the screen each life cycle will not call again, Only the onConfigurationChanged method is executed.

8. How to distribute SQLite database (.db file) with APK file?

Copy the xxx. db file to the res AW directory in the project. The files in this target will not be compressed

9. How to open the database file in the RES AW directory?

Use openDatabase to open the database file. If the file does not exist, the system automatically creates /sdcard/dictionary directory on the SD card, and copies xxx.db from res/raw to the directory automatically created

10. What kinds of classes do Android have for parsing XML? What is the official recommendation? How do they work and how do they differ?

B. PC DOM is relatively easy to use, but sensitive databases or mobile phones are mainly used in SAX mode, SAX reading is one-way, advantages: does not occupy memory space, convenient attribute parsing. Disadvantages: Inconvenient processing for nested branches. DOM: Loads the entire XML file into memory, which Android developers can use in conjunction with XPath (not much data) and is recommended. PULL:J2ME is better for node processing. In J2ME, it usually uses the KXML library to parse in a SAX manner

11. The difference between DDMS and TraceView?

A. DDMS is a program execution viewer, which can see information such as threads and stacks. B. TraceView is a program performance analyzer

12. What does the Application class do?

Initialize resources and share data

13. What about Android IPC?

IPC is short for internal process communication. The IPC mechanism in Android is designed to allow interaction between activities and services at any time. Therefore, IPC is only applicable to the communication between activities and services in Android. The Service implements the IPC interface, and the Client invokes the local proxy of the IPC interface.

14. What is NDK?

A. NDK helps developers quickly develop C/C++ dynamic libraries and automatically package SO and Java applications into APK packages. B. NDK integrates the cross-compiler and provides mk files and isolation of CPU, platform differences. Developers only need to modify mk files to create so files

15.Android Service life cycle? Which method can be called more than once?

a. startService() : StartService () -> onCreate() -> onStart(multiple calls) -> stopService() -> onDestory() ->stop If the Service is not already running, It calls onCreate() and then onStart(); OnStart () is called directly if the Service is already running, so the onStart() method of a Service may be called multiple times. If the caller exits without calling stopService, the Service will always run in the background.

b. bindService() : BindService () -> onCreate() -> onBind() -> onUnbind() -> onDestory() -> Stop content is bound to the service lifecycle

16. Broadcast lifecycle for Android?

17. Android view, surfaceView, what is the difference between glsurfaceview? 18. How does Android update APK?

19. What design patterns have you used in your work?

20. The mobile phone has multiple browsers installed. Can you specify a browser to access a specific page?

You can either send the parameter directly to the Url or set it via the Data attribute in intentFilter in the Android configuration manifest