標籤:
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
Android四大組件