【发布时间】:2014-09-11 04:36:37
【问题描述】:
我正在看这个例子 https://developer.android.com/training/location/retrieve-current.html#CheckServices
这里是有问题的代码:
public class MainActivity extends FragmentActivity {
...
private boolean servicesConnected() {
...
if (ConnectionResult.SUCCESS == resultCode) {
...
// Google Play services was not available for some reason.
// resultCode holds the error code.
} else {
// Get the error dialog from Google Play services
Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
resultCode,
this,
CONNECTION_FAILURE_RESOLUTION_REQUEST);
...
}
}
}
如果我们查看GooglePlayServicesUtil.getErrorDialog(..),我们传递的是对this 的引用,它恰好是Activity。
问题是: 这会在配置更改期间导致内存泄漏吗?
我想答案取决于GooglePlayServicesUtil.getErrorDialog(..) 如何/是否在内部保留对Activity 的引用。
【问题讨论】:
标签: android google-play-services