【Android4.2系统源码】Activity学习
来源:互联网 发布:洗车刷卡软件 编辑:程序博客网 时间:2024/05/21 20:03
先看看Activity继承了哪些东西:
public class Activity extends ContextThemeWrapper implements LayoutInflater.Factory2, Window.Callback, KeyEvent.Callback, OnCreateContextMenuListener, ComponentCallbacks2
ContextThemeWrapper 主题包装?
来看张图:
接着是一些接口:
LayoutInflater.Factory2,Window.Callback, KeyEvent.Callback,OnCreateContextMenuListener,ComponentCallbacks2
关于Activity的onCreate
protected void onCreate(Bundle savedInstanceState) { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState); if (mLastNonConfigurationInstances != null) { mAllLoaderManagers = mLastNonConfigurationInstances.loaders; } if (mActivityInfo.parentActivityName != null) { if (mActionBar == null) { mEnableDefaultActionBarUp = true; } else { mActionBar.setDefaultDisplayHomeAsUpEnabled(true); } } if (savedInstanceState != null) { Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG); mFragments.restoreAllState(p, mLastNonConfigurationInstances != null ? mLastNonConfigurationInstances.fragments : null); } mFragments.dispatchCreate(); getApplication().dispatchActivityCreated(this, savedInstanceState); mCalled = true; }
DEBUG_LIFECYCLE是标识生命周期,
NonConfigurationInstances在上文是这么定义的:
static final class NonConfigurationInstances { Object activity; HashMap<String, Object> children; ArrayList<Fragment> fragments; HashMap<String, LoaderManagerImpl> loaders; }
然后是onpause
protected void onPause() { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onPause " + this); getApplication().dispatchActivityPaused(this); mCalled = true; }
生命周期进入停止状态,但未杀死
关于onStop
protected void onStop() { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onStop " + this); if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(false); getApplication().dispatchActivityStopped(this); mCalled = true; }
关于OnDestory
protected void onDestroy() { if (DEBUG_LIFECYCLE) Slog.v(TAG, "onDestroy " + this); mCalled = true; // dismiss any dialogs we are managing. if (mManagedDialogs != null) { final int numDialogs = mManagedDialogs.size(); for (int i = 0; i < numDialogs; i++) { final ManagedDialog md = mManagedDialogs.valueAt(i); if (md.mDialog.isShowing()) { md.mDialog.dismiss(); } } mManagedDialogs = null; } // close any cursors we are managing. synchronized (mManagedCursors) { int numCursors = mManagedCursors.size(); for (int i = 0; i < numCursors; i++) { ManagedCursor c = mManagedCursors.get(i); if (c != null) { c.mCursor.close(); } } mManagedCursors.clear(); } // Close any open search dialog if (mSearchManager != null) { mSearchManager.stopSearch(); } getApplication().dispatchActivityDestroyed(this); }
0 0
- 【Android4.2系统源码】Activity学习
- Android4.2 keyguard源码架构,学习(一)!
- Android4.4.4启动Activity源码记录
- Android4.0 图形系统学习
- android4.2系统bug
- Android4.4系统源码重要文件位置总结
- Ubuntu12.04系统编译Android4.4源码
- Android4.4源码添加系统自定义服务
- android4.2源码下载过程
- android4.2源码编译全过程
- android4.2源码下载过程
- android4.4系统源码编译(二)_源码下载
- 修改android4.2系统源码实现system组和root用户访问sd卡
- Android4.2系统全面解析
- Android4.2系统全面解析
- android4.2修改系统字体大小
- android4.0源码下载 编译 系统体验~图解
- XP系统ubuntu搭建Android4.1源码开发环境
- JPEG算法概述及实现
- Source insight中显示TAB符用4个空格代替
- 确保对象的唯一性——单例模式 (五):单例模式总结
- IOS-KVC,KVO与MVC设计模式
- 史上最全github使用方法:github入门到精通
- 【Android4.2系统源码】Activity学习
- AFNetWorking的使用方法
- Scala 中for循环示例
- mac 下删除mysql
- android从网络上拿图的几个方式
- IOS-多控制器管理一
- Machine Learning-朴素贝叶斯算法
- Windowsoftinputmode属性使用
- 20160111 图书搜索