Android Development Notes-4(BroadcastReceiver, Manifests)
2016-06-22 23:15
387 查看
Summary: BroadcastReceiver, Manifests, Delvik VM, Zigote, Life Cycle, apk
-A broadcast receiver receives the action of Intent objects, similarly to an Activity , but does not have its own user interface
-A typical use for a broadcast receiver might be to receive an alarm that causes an app to become active at a particular time
-Android requires applications to explicitly describe their contents in an XML file called AndroidManifest.xml
-Activity , Service , ContentProvider , and BroadcastReceiver provide the foundation of Android application development . To make use of any of them, an application must include corresponding declarations in its AndroidManifest.xml file.
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/21/470242ff5125e6d30f6f97206129960d)
AndroidManifest.xml sample:
res/
layout/
... contains application layout files ...
drawable/
...contains images, patches, drawable xml ...
raw/
... contains data files that can be loaded as streams ...
values/
... contains xml files that contain string, number values used in code ...
src/
java/package/directories/
-Android executes multiple instances of the Dalvik VM, one for each task
-Android must efficiently divide memory into multiple heaps. Each heap should be relatively small so that many applications can fit in memory at the same time.
-Android’s approach to multiprocessing, using multiple processes and multiple instances of a VM, requires that each instance of the VM be space-efficient. This is achieved
partly through the component life cycle, which enables objects to be garbage-collected and recreated, and partly by the VM itself.
-Zygote. It is an instance of the Dalvik VM that contains a set of preloaded classes for enhancement of performance.
-The most complex component life cycle is the activity life cycle. Here we will diagram it and take a look at how these state transitions are handled in code
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/21/a60fbea1a279a16736b9578c20de56ae)
-Sample code:
-Android provides an application called apkbuilder for generating installable Android application files, which have the extension .apk. An .apk file is in ZIP file format
Author:Joey_Zhang
-A broadcast receiver receives the action of Intent objects, similarly to an Activity , but does not have its own user interface
-A typical use for a broadcast receiver might be to receive an alarm that causes an app to become active at a particular time
-Android requires applications to explicitly describe their contents in an XML file called AndroidManifest.xml
-Activity , Service , ContentProvider , and BroadcastReceiver provide the foundation of Android application development . To make use of any of them, an application must include corresponding declarations in its AndroidManifest.xml file.
AndroidManifest.xml sample:
res/
layout/
... contains application layout files ...
drawable/
...contains images, patches, drawable xml ...
raw/
... contains data files that can be loaded as streams ...
values/
... contains xml files that contain string, number values used in code ...
src/
java/package/directories/
-Android executes multiple instances of the Dalvik VM, one for each task
-Android must efficiently divide memory into multiple heaps. Each heap should be relatively small so that many applications can fit in memory at the same time.
-Android’s approach to multiprocessing, using multiple processes and multiple instances of a VM, requires that each instance of the VM be space-efficient. This is achieved
partly through the component life cycle, which enables objects to be garbage-collected and recreated, and partly by the VM itself.
-Zygote. It is an instance of the Dalvik VM that contains a set of preloaded classes for enhancement of performance.
-The most complex component life cycle is the activity life cycle. Here we will diagram it and take a look at how these state transitions are handled in code
-Sample code:
@Override protected void onSaveInstanceState(Bundle outState) { // Save instance-specific state outState.putString("answer", state); super.onSaveInstanceState(outState); Log.i(TAG, "onSaveInstanceState"); }
@Override protected void onRestoreInstanceState(Bundle savedState) { super.onRestoreInstanceState(savedState); // Restore state; we know savedState is not null String answer = savedState.getString("answer"); // ... Log.i(TAG, "onRestoreInstanceState" + (null == savedState ? "" : RESTORE) + " " + answer); }-In a lot of Android code, especially in small examples, very few life cycle callbacks are implemented. That is because the Activity parent class handles life cycle callbacks
-Android provides an application called apkbuilder for generating installable Android application files, which have the extension .apk. An .apk file is in ZIP file format
Author:Joey_Zhang
相关文章推荐
- Android中BroadcastReceiver(异步接收广播Intent)的使用
- Android使用BroadcastReceiver实现手机开机之后显示画面的功能
- Android提高之BroadcastReceiver实例详解
- 详解Android中BroadCastReceiver组件
- Android编程四大组件之BroadcastReceiver(广播接收者)用法实例
- Android开发之BroadcastReceiver用法实例分析
- 广播 BroadCastReceiver
- BroadcastReceiver应用详解
- PHP Life Cycle演讲幻灯片(PHP Life Cycle Slides)
- Android中利用广播接受者简单几步实现拨号显示归属地
- 拦截短信
- Android中BroadcastReceiver理解
- 关于安卓手机开机自启动APP无法成功的问题
- android 监听SDCard安装和卸载的代码
- BroadcastReceiver实现android来去电录音功能(外录)
- 小米手机不支持对去电的拦截解决方案(BroadcastReceiver)
- BroadcastReceiver之开机自启动程序
- 工作笔记(1)--Android平板禁用虚拟按键
- 一步一步的学习BroadCastReceiver