Merge "Fix MobileNetworkSettings crash for multi-SIM device"
am: 33cf927f86

Change-Id: I2c59cde57994ea71cc602485df49da48a612fd73
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 2d8ba6d..bc233f7 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -47,8 +47,10 @@
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Log;
+import android.view.LayoutInflater;
 import android.view.MenuItem;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.TabHost;
 
 import com.android.ims.ImsManager;
@@ -315,8 +317,6 @@
                     if (DBG) log("initializeSubscriptions: UPDATE");
                     currentTab = mTabHost != null ? mTabHost.getCurrentTab() : 0;
 
-                    getActivity().setContentView(com.android.internal.R.layout.common_tab_settings);
-
                     mTabHost = (TabHost) getActivity().findViewById(android.R.id.tabhost);
                     mTabHost.setup();
 
@@ -355,7 +355,6 @@
                         mTabHost.clearAllTabs();
                         mTabHost = null;
                     }
-                    getActivity().setContentView(com.android.internal.R.layout.common_tab_settings);
                     break;
                 }
                 case DO_NOTHING: {
@@ -490,10 +489,22 @@
                     TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
             getActivity().registerReceiver(mPhoneChangeReceiver, intentFilter);
 
-            initializeSubscriptions();
             Log.i(LOG_TAG, "onCreate:-");
         }
 
+        @Override
+        public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                Bundle savedInstanceState) {
+            return inflater.inflate(com.android.internal.R.layout.common_tab_settings,
+                    container, false);
+        }
+
+        @Override
+        public void onActivityCreated(Bundle savedInstanceState) {
+            super.onActivityCreated(savedInstanceState);
+            initializeSubscriptions();
+        }
+
         private class PhoneChangeReceiver extends BroadcastReceiver {
             @Override
             public void onReceive(Context context, Intent intent) {