首页 > 移动平台 > 详细

Android四大组件

时间:2016-05-02 00:22:16      阅读:257      评论:0      收藏:0      [点我收藏+]

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四大组件

原文:http://www.cnblogs.com/3013218061shang/p/5451565.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!