protected void onResume() {
   super.onResume();
   registerReceiver(mReceiver, mIntentFilter);
   mNamePreference.resume();
   mEnablerPreference.resume();
   setScreenState();
 }
  protected void onPause() {
    super.onPause();

    unregisterReceiver(mReceiver);
    mNamePreference.pause();
    mEnablerPreference.pause();
    if (mErrorDialog != null) {
      logd("pause: dismiss error dialog");
      mErrorDialog.dismiss();
      mErrorDialog = null;
    }
    mSubscriptionManager.unRegisterForSetSubscriptionCompleted(mHandler);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.multi_sim_configuration_dual_mode);

    mPrefScreen = getPreferenceScreen();

    Intent intent = getIntent();
    mSubscription = intent.getIntExtra(SUBSCRIPTION_KEY, CARD1);
    mSubscriptionManager = SubscriptionManager.getInstance();

    mNamePreference = (MultiSimNamePreference) findPreference(KEY_SIM_NAME);
    mNamePreference.setSubscription(mSubscription);

    mEnablerPreference = (MultiSimEnablerForDualMode) findPreference(KEY_SIM_ENABLER);
    mEnablerPreference.setSubscription(this, mSubscription);
    mNetworkSetting = (PreferenceScreen) findPreference(KEY_NETWORK_SETTING);
    mNetworkSetting
        .getIntent()
        .putExtra(
            MultiSimSettingsConstants.TARGET_PACKAGE, MultiSimSettingsConstants.NETWORK_PACKAGE)
        .putExtra(MultiSimSettingsConstants.TARGET_CLASS, MultiSimSettingsConstants.NETWORK_CLASS)
        .putExtra(SUBSCRIPTION_KEY, mSubscription);

    mCallSetting = (PreferenceScreen) findPreference(KEY_CALL_SETTING);
    mCallSetting
        .getIntent()
        .putExtra(MultiSimSettingsConstants.TARGET_PACKAGE, MultiSimSettingsConstants.CALL_PACKAGE)
        .putExtra(MultiSimSettingsConstants.TARGET_CLASS, MultiSimSettingsConstants.CALL_CLASS)
        .putExtra(SUBSCRIPTION_KEY, mSubscription);

    mIntentFilter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
    mCardSubscriptionManager = CardSubscriptionManager.getInstance();
    mCDMACheckbox = (CheckBoxPreference) findPreference(KEY_CDMA_CHECKBOX);
    mGSMCheckbox = (CheckBoxPreference) findPreference(KEY_GSM_CHECKBOX);
    mCDMACheckbox.setOnPreferenceChangeListener(this);
    mGSMCheckbox.setOnPreferenceChangeListener(this);
    mUserSelSub = new SubscriptionData(MAX_SUBSCRIPTIONS);
    mCardSubscrInfo = new SubscriptionData[MAX_SUBSCRIPTIONS];
    mCurrentSelSub = new SubscriptionData(MAX_SUBSCRIPTIONS);
    for (int i = 0; i < MAX_SUBSCRIPTIONS; i++) {
      mCardSubscrInfo[i] = mCardSubscriptionManager.getCardSubscriptions(i);
      if (mCardSubscrInfo[i] != null) {
        Log.d(LOG_TAG, mCardSubscrInfo[i].toString());
        if (i == CARD1) {
          mIccId = mCardSubscrInfo[CARD1].subscription[0].iccId;
        }
      }

      Subscription sub = mSubscriptionManager.getCurrentSubscription(i);
      mCurrentSelSub.subscription[i].copyFrom(sub);
    }
    mUserSelSub.copyFrom(mCurrentSelSub);
    Log.d(LOG_TAG, "Current sub start....");
    Log.d(LOG_TAG, mCurrentSelSub.toString());
    Log.d(LOG_TAG, "Current sub end....");

    if (mSubscriptionManager.isSetSubscriptionInProgress()) {
      Log.d(LOG_TAG, "onCreate: SetSubscription is in progress when started this activity");
      showDialog(DIALOG_SET_SUBSCRIPTION_IN_PROGRESS);
      mSubscriptionManager.registerForSetSubscriptionCompleted(
          mHandler, EVENT_SET_SUBSCRIPTION_DONE, null);
    }
    mstm = (MSimTelephonyManager) this.getSystemService(Context.MSIM_TELEPHONY_SERVICE);
  }