如何始终保持最新引用到活动 [英] How to keep always up-to-date reference to Activity

查看:152
本文介绍了如何始终保持最新引用到活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个活动,我想保持在第一<$ C第二活动的参考$ C>活动。什么是保持基准永远是最好的办法了最新的,因为据我了解一个活动的新实例每次活动正在启动。


解决方案

  

我要保持在第一活动第二活动的参考。


您绝对肯定不希望这样做。查找任何问题,你认为你正在试图解决另一个解决方案。

要澄清,这将引入内存泄漏。

I have two Activities and I want to keep a reference of a second Activity in a first Activity. What would be the best way to keep the reference always up-to-date because as far as I understand new instance of an Activity is created each time the Activity is launching.

解决方案

I want to keep a reference of a second Activity in a first Activity.

You absolutely positively do NOT want to do this. Find another solution for whatever problem you think you are trying to solve.

To clarify, this will introduce memory leaks.

这篇关于如何始终保持最新引用到活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆