Summarize the interview questions yourself

1 How does Scrollview judge whether to slide to the bottom
? 2 The paging principle of listview 3 How does ViewPager
perform performance optimization ?




8 The execution sequence of onTouch onTouchEvent and onClick in the view!

Three golds and four silvers, it is the annual job-hopping season again. Maybe a lot of Android programmers are starting to gear up. Combined with my own experience in the past, I will summarize the Android interview questions for you today, I hope it will help.

1: Activity life cycle?

This is pretty much a question of all ages, never going out of style, and most likely the first. Of course, this question is nothing to talk about. It is useless to memorize it by memorization. The key is to understand. I have encountered a variant of this problem, asking what is the difference between onStart() and onResume()? If the interviewer throws this question, is it a bit off-guard. Today, I heard that some students have encountered a more perverted problem: under what circumstances does the Activity go to onCreat() instead of onStart(). This is simply a brain teaser.

2: Service life cycle?

It should be noted here that there are two ways to start the service, startService() and bindService()


Paste_Image.png
3: How to understand the relationship between Activity, View and Window?

This question is really difficult to answer. So here is a more appropriate metaphor to describe their relationship. Activity is like a craftsman (control unit), Window is like window (carrying model), View is like window grille (display view) LayoutInflater is like scissors, Xml configuration is like window grille drawing.
1: When the Activity is constructed, a Window will be initialized, to be precise, the PhoneWindow.
2: This PhoneWindow has a "ViewRoot", this "ViewRoot" is a View or ViewGroup, which is the initial root view.
3: "ViewRoot" adds Views one by one through the addView method. Such as TextView, Button, etc.
4: The event listeners of these Views are received by the WindowManagerService and called back to the Activity function. Such as onClickListener, onKeyDown, etc.

4: Several LaunchModes and usage scenarios of Activity

standard mode
This is the default mode, an Activity instance is created every time an Activity is activated and placed in the task stack. Usage scenarios: most activities.
In singleTop mode
, if there is an instance of the Activity at the top of the task's stack, the instance is reused (the instance's onNewIntent() will be called), otherwise a new instance will be created and placed on the top of the stack, even if the Activity already exists in the stack. Instances, as long as they are not at the top of the stack, will create new instances. Use scenarios such as news or reading app content pages.
singleTask mode
If there is already an instance of the Activity in the stack, reuse the instance (the instance's onNewIntent() will be called). Reuse will bring the instance back to the top of the stack, so the instances above it will be popped off the stack. If the instance does not exist on the stack, a new instance will be created and placed on the stack. Use scenarios such as the main interface of a browser. No matter how many applications are started from the browser, the main interface will only be launched once, and the rest will go to onNewIntent, and other pages above the main interface will be cleared.
The singleInstance mode
creates an instance of the Activity in a new stack and lets multiple applications share the Activity instance in the stack. Once an Activity instance of this mode already exists in a stack, any application that activates the Activity will reuse the instance in the stack (calling the instance's onNewIntent() ). Its effect is equivalent to that of multiple applications sharing one application, and whoever activates the Activity will enter the same application. Use scenarios such as alarm reminders to separate alarm reminders from alarm settings. Do not use singleInstance for the intermediate page. If it is used for the intermediate page, there will be problems with jumping, such as: A -> B (singleInstance) -> C. After exiting completely, it will be started here, and B will be opened first.

5: View drawing process

measure过程
layout过程
draw过程

http://blog.csdn.net/yanbober/article/details/46128379/

6:Touch事件的传递机制
publicbooleandispatchTouchEvent(MotionEventev);  //用来分派event
publicbooleanonInterceptTouchEvent(MotionEventev);//用来拦截event
publicbooleanonTouchEvent(MotionEventev);//用来处理event

其中Activity和View控件(TextView)拥有分派和处理事件方法,View容器(LinearLayout)具有分派,拦截,处理事件方法。这里也有个比喻:领导都会把任务向下分派,一旦下面的人把事情做不好,就不会再把后续的任务交给下面的人来做了,只能自己亲自做,如果自己也做不了,就只能告诉上级不能完成任务,上级又会重复他的过程。另外,领导都有权利拦截任务,对下级隐瞒该任务,而直接自己去做,如果做不成,也只能向上级报告不能完成任务。
http://gold.xitu.io/entry/56af0ba0c24aa800547b60ea
http://blog.csdn.net/morgan_xww/article/details/9372285

7:Android中的几种动画

曾被问到Android中有几种动画,这个问题也好难回答。Android3.0之前有2种,3.0后有3种。
FrameAnimation(逐帧动画):将多张图片组合起来进行播放,类似于早期电影的工作原理,很多App的loading是采用这种方式。
TweenAnimation(补间动画):是对某个View进行一系列的动画的操作,包括淡入淡出(Alpha),缩放(Scale),平移(Translate),旋转(Rotate)四种模式。
PropertyAnimation(属性动画):属性动画不再仅仅是一种视觉效果了,而是一种不断地对值进行操作的机制,并将值赋到指定对象的指定属性上,可以是任意对象的任意属性。
http://blog.csdn.net/yanbober/article/details/46481171

8:Android中跨进程通讯有几种方式

1:访问其他应用程序的Activity
如调用系统通话应用

IntentcallIntent=newIntent(Intent.ACTION_CALL,Uri.parse("tel:12345678");
startActivity(callIntent);

2:Content Provider
如访问系统相册

3:广播(Broadcast)
如显示系统时间

4:AIDL服务

9:AIDL理解

http://bbs.51cto.com/thread-1086040-1.html

10:Handler的原理

http://blog.csdn.net/lmj623565791/article/details/38377229

11:Binder机制原理

http://blog.csdn.net/boyupeng/article/details/47011383

12:热修复的原理

1:JavaSisst
2:AspectJ
3:Xposef
这里给出Xposef方案
http://mp.weixin.qq.com/s?__biz=MzA3Mjk1MjA4Nw==&mid=400452659&idx=1&sn=841b49b875ec3b307f261ed52a7d9c4e&scene=23&srcid=1119JWRt0adNwGxTHiyok460#rd

13:设计一套图片异步加载缓存方案

http://www.cnblogs.com/zyw-205520/p/4997863.html
http://blog.csdn.net/boyupeng/article/details/47127605

14:Android内存泄露及管理

http://gold.xitu.io/entry/56d64b9e816dfa005943a55c

15:Activity与Fragment通信

http://gold.xitu.io/entry/56a87b2b2e958a0051906227

16:Fragment的那些坑

http://www.jianshu.com/p/d9143a92ad94
http://www.jianshu.com/p/fd71d65f0ec6
http://www.jianshu.com/p/38f7994faa6b

16:Android UI适配

这里给出hongyang大神的方案
http://blog.csdn.net/lmj623565791/article/details/45460089

17:布局优化

http://www.jianshu.com/p/145fc61011cd

18:Http Https

http://www.jianshu.com/p/93fdebe5fef1

19: Network request optimization

http://www.jianshu.com/p/3141d4e46240

20: Database Optimization

http://www.jianshu.com/p/3b4452fc1bbd

21: Image optimization

http://www.jianshu.com/p/5bb8c01e2bc7

22: HybridJAVA interacts with JS

http://droidyue.com/blog/2014/09/20/interaction-between-java-and-javascript-in-android/

23: Singleton

http://www.jianshu.com/p/a956024629cb

24: Java GC principle

http://www.jianshu.com/p/d75a32ac5bed?

25:ANR

http://www.jianshu.com/p/124f3b75e164

26:Volley

http://www.jianshu.com/p/9e17727f31a1

27: JAVA Annotation Reflection Principle

http://www.jianshu.com/p/3968ffabdf9d

28: Algorithms

http://www.jianshu.com/p/ae97c3ceea8d

29: Design Patterns

http://gold.xitu.io/entry/56ebb4ad5bbb50004c440972

30 : RxJava

http://gank.io/post/560e15be2dca930e00da1083?from=timeline&isappinstalled=0#toc_1


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325528908&siteId=291194637