Summary:Activity, Intents, and Tasks,Service,Content provider

-Android introduces a richer and more complex approach by supporting multiple application entry points. Android programs should expect the system to start them indifferent places, depending on where the user is coming from and what she wants todo next

Activity, Intents, and Tasks

-An Android activity is both a unit of user interaction—typically filling the wholescreen of an Android mobile device—and a unit of execution

-The unit of communication is the Intent class. An Intent represents anabstract description of a function that one activity requires another activity to perform,such as taking a picture.

public class TestActivity extends Activity {/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);}}
-The onCreate method kicks off the lifecycle of the Activity
-An Activity interactswith the Android runtime to implement key aspects of the application life cycle. Eachactivity can also be independently configured, through a Context class

-Each activity in an Android application is largely separate from other activities. Thecode that implements one activity does not directly call methods in the code that implements another activity.

-Instead of a user interface flow control based on method calls, applications describe anIntent that they want to execute and ask the system to find one that matches.

Android development Notes-3(Activity, Intents, and Tasks, Service, Content provider)_第1张图片

Service

-The Android Service class is for background tasks that may be active but not visibleon the screen.

-The Android platform avoids reclaiming service resources, soonce a service starts, it is likely to be available unless memory gets extremelyconstrained.

Content provider

-Content provider components are roughly analogous to a RESTful web service: youfind them using a URI, and the operations of a ContentProvider subclass parallelRESTful web operations such as putting and getting data.

-REST stands for “Representational State Transfer.”

-Content provider components are the heart of the Android content model: by providinga ContentProvider , your application can share data with other applications and managethe data model of an application.

-A companion class, ContentResolver , enables othercomponents in an Android system to find content providers.

-Due to its importance in Android, we provide a brief introduction here to writing aclient that uses a content provider

-Activities access specific content provider instancesusing the ContentResolver class and associated URLs as follows:

// code from an activity methodContentProviderClient client = getContentResolver().acquireContentProviderClient("content://contacts/people");ContentProvider provider = client.getLocalContentProvider();
-Together with the Activity component of an Android application, content providersprovide the necessary parts of a Model-View-Controller (MVC) architecture.



更多相关文章

  1. android 网络图片查看器
  2. Android 图片压缩
  3. android 网络请求图片
  4. android Animation图片渐变动画 Demo
  5. 使用android的bitmap类实现图片的拼接
  6. android下图片压缩
  7. android 图片展示
  8. Android播放GIF图片

随机推荐

  1. 利用Handler来更新android的UI (2)
  2. Android(安卓)Camera调用流程
  3. [Android]googleMap的简单使用,地图定位,图
  4. Android(安卓)支持多屏幕机制
  5. Android中如何查看so崩溃的log
  6. Android(安卓)无线启动过程分析 无线启动
  7. Android(安卓)自定义标签 和 自定义组件
  8. Android(安卓)开发常用ADB命令集合
  9. 【Android】EditText的特殊属性介绍
  10. android Gallery实现加载网络图片