Android知识点
2016-07-26 10:18:59 0 举报
AI智能生成
Android是一个基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑。它由Google主导开发,提供了一套完整的应用程序开发框架,包括Java编程语言、XML布局文件以及各种用于构建用户界面的工具。Android系统具有高度的可定制性,可以根据设备制造商和运营商的需求进行定制。此外,Android还拥有丰富的应用生态系统,用户可以在Google Play商店中下载数以百万计的应用程序。
作者其他创作
大纲/内容
ListView
RecycleBin机制
Adpater在ListView和数据源之间起到了一个桥梁的作用
ViewHolder
AsyncTask vs Handler
The difference between Handler and AsyncTask is: Use AsyncTask when Caller thread is a UI Thread.
AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations
and publish results on the UI thread without having to manipulate threads and/or handlers
Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue
ANR
三种类型
KeyDispatchTimeout(5 seconds) --主要是类型按键或触摸事件在特定时间内无响应
BroadcastTimeout(10 seconds) --BroadcastReceiver在特定时间内无法处理完成
ServiceTimeout(20 secends) --小概率事件 Service在特定的时间内无法处理完成
基础
布局:FrameLayout 、 LinearLayout 、 AbsoluteLayout 、 RelativeLayout 、 TableLayout 全都继承自ViewGroup
Activity生命周期
onCreat
onStart
onResume
onPause
onStop
锁定屏与解锁屏幕 只会调用onPause(),而不会调用onStop()方法,开屏后则调用onResume()
Activity缓存方法
onSaveInstanceState:回收前调用,onCreate是从savedInstanceState获取数据
为什么在Service中创建子线程而不是Activity中
Activity会被销毁,而service可以和activity关联并且在后台不会被销毁
数据存储
SQLite:SQLite
SharedPreference
File
ContentProvider: Android系统中能实现所有应用程序共享的一种数据存储方式
框架
okHttp
Retrofit
EventBus
Context区别
每一个Activity和Service以及Application的Context都是一个新的ContextImpl对象
getApplication()用来获取Application实例的,但是这个方法只有在Activity和Service中才能调用的到。
getApplicationContext()比getApplication()方法的作用域会更广一些,任何一个Context的实例
IntentService
IntentService是Service的子类,是一个异步的,会自动停止的服务,
很好解决了传统的Service中处理完耗时操作忘记停止并销毁Service的问题
Gradle
内存泄露
内存泄漏汇总
集合类泄漏
单例造成的内存泄漏
Handler 造成的内存泄漏
Activity vs Fragement
https://github.com/xxv/android-lifecycle
0 条评论
下一页
为你推荐
查看更多