当前位置: 首页 > news >正文

Activity中Context

Activity中Context在activity.attach()设置,所以Application中Context为ContextImpl appContext = createBaseContextForActivity(r);,即在ContextImpl.createActivityContext()设置DispalyId

private ContextImpl createBaseContextForActivity(ActivityClientRecord r) {final int displayId = ActivityClient.getInstance().getDisplayId(r.token);ContextImpl appContext = ContextImpl.createActivityContext(this, r.packageInfo, r.activityInfo, r.token, displayId, r.overrideConfig);// The rotation adjustments must be applied before creating the activity, so the activity// can get the adjusted display info during creation.if (r.mPendingFixedRotationAdjustments != null) {// The adjustments should have been set by handleLaunchActivity, so the last one is the// override for activity resources.if (mActiveRotationAdjustments != null && !mActiveRotationAdjustments.isEmpty()) {mResourcesManager.overrideTokenDisplayAdjustments(r.token,mActiveRotationAdjustments.get(mActiveRotationAdjustments.size() - 1).second);}r.mPendingFixedRotationAdjustments = null;}final DisplayManagerGlobal dm = DisplayManagerGlobal.getInstance();// For debugging purposes, if the activity's package name contains the value of// the "debug.use-second-display" system property as a substring, then show// its content on a secondary display if there is one.String pkgName = SystemProperties.get("debug.second-display.pkg");if (pkgName != null && !pkgName.isEmpty()&& r.packageInfo.mPackageName.contains(pkgName)) {for (int id : dm.getDisplayIds()) {if (id != Display.DEFAULT_DISPLAY) {Display display =dm.getCompatibleDisplay(id, appContext.getResources());appContext = (ContextImpl) appContext.createDisplayContext(display);break;}}}return appContext;
}

http://www.lryc.cn/news/376495.html

相关文章:

  • 位图法-有效的数独
  • Zookeeper ZNode 数据结构原理
  • Golang - 90天从新手到大师
  • MyBatis常用转义字符 大于、小于、大于等于、小于等
  • Python --- 如何修改Jupyter Notebook在本地保存文件的默认路径?
  • 大模型 舆情分析 数据构造 prompt提示词 经验分享 数据准备
  • 这些已经死去的软件,依旧无可替代
  • SYD88xx使代码在RAM内存中执行/运行
  • 基于支持向量机的垃圾邮件分类,使用SVM+flask+vue
  • 目标检测数据集 - 零售食品LOGO检测数据集下载「包含VOC、COCO、YOLO三种格式」
  • 47.PyCharm P版突然无法启动
  • 「动态规划」如何求粉刷房子的最少花费?
  • 代码随想录算法训练营DAY41|背包问题 二维 、背包问题 一维、416. 分割等和子集
  • gitlab2024最新版安装
  • 2022C语言二级真题
  • 智慧购房:链家网上海在售楼盘数据解析与模型构建
  • 二进制数转字符串
  • WINDOWS系统jdk和maven明明安装了cmd里却无法使用相关命令
  • 基于EasyAnimate模型的视频生成最佳实践
  • linux最大线程数限制及打开最大文件数
  • MyBatis系列七: 一级缓存,二级缓存,EnCache缓存
  • C++迈向精通:函数指针对象与函数对象
  • 类和对象知识点
  • 【FAS】《Survey on face anti-spoofing in face recognition》
  • 【Unity】RPG2D龙城纷争(一)搭建项目、导入框架、前期开发准备
  • 多目标跟踪中检测器和跟踪器如何协同工作的
  • kali系统几个开机启动项的区别
  • 【自撰写】【国际象棋入门】第5课 常见开局战术组合(一)
  • 高考志愿填报选专业,女孩就业率最好的专业有哪些?
  • yolov5模型训练早停模型变大