【发布时间】:2009-05-20 21:31:01
【问题描述】:
我发现检索 MCC 和 MNC 的唯一方法是重写活动的 onConfigurationChanged 方法,如下所示:
public void onConfigurationChanged(Configuration config)
{
super.onConfigurationChanged(config);
DeviceData.MCC = "" + config.mcc;
DeviceData.MNC = "" +config.mnc;
}
但是,我在应用程序启动时需要这些数据,并且不能等待用户切换手机的方向或等效来触发此方法。有没有更好的方法来访问当前的 Configuration 对象?
【问题讨论】: