Android四大组件

Activity:

      onCreat() onStart() onRestart() onResume() onPause() onStop() onDestory()

      四个基本状态:活动中 暂停 停止 待用

    standard模式 创建新的activity

    singleTop模式 调用顶部activity时不创建新的

      singleTask模式一个activity实例只存在一个

      singleInstance模式新建Task

       恢复activity onSaveInstanceState() onCreat(){ savedInstanceState.get()}

 

    Intent:

      action data category type component extras flag

      显示Intent setComponent() setClass()

       隐式Intent InterFilter

    BroadcastReceeiver:

      继承BroadcastReceiver 实现onReceiver() 函数

  静态注册AndroidManifest.xml 动态注册 onCreat() 或onStart()中注册 onStop() 或onDestory()中撤销

  普通广播 有序广播(intent-filter 中priority)

Service:

  onCreate() onStartCommand() onBind( return null ) onDestroy()

       startService()->onCreate()->onStartCommand()->running-> onDestroy()

       启动形式的service 继承Service(主线程中执行)继承IntentService(创建新的线程串行执行) 只需实现onHandleIntent() 方法

       bindService()->onCreate()->onBind( return IBinder )-> binded-> onUnbind()->onDestroy()

       绑定形式的service继承Service 创建一个inner class继承Binder 创建getService(return outerService.this)方法

       ServiceConnection类:onServiceConnected(),onServiceDisconnected()

    ContentPrivoder:

      onCreate() query() update() getType() delete() insert() Uri.parse(String)

      getContentResolver() android:authorities

posted @ 2016-05-01 23:52  咸_鱼  Views(260)  Comments(0Edit  收藏  举报