diff --git a/res/values/ids.xml b/res/values/ids.xml
index 1a553d1..2de327a 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -18,7 +18,6 @@
     <item type="id" name="data"/>
     <item type="id" name="header_phones"/>
     <item type="id" name="dialog_sync_add"/>
-    <item type="id" name="dialog_import_export"/>
 
     <!-- For vcard.ImportVCardActivity -->
     <item type="id" name="dialog_searching_vcard"/>
@@ -39,9 +38,6 @@
     <item type="id" name="dialog_delete_contact_confirmation"/>
     <item type="id" name="dialog_delete_contact_loader_id" />
 
-    <!-- For ImportExportInteraction -->
-    <item type="id" name="dialog_import_export_options"/>
-
     <!-- For ExportVCardActivity -->
     <item type="id" name="dialog_export_confirmation"/>
     <item type="id" name="dialog_exporting_vcard"/>
diff --git a/src/com/android/contacts/activities/ContactBrowserActivity.java b/src/com/android/contacts/activities/ContactBrowserActivity.java
index 0672481..ba72ecc 100644
--- a/src/com/android/contacts/activities/ContactBrowserActivity.java
+++ b/src/com/android/contacts/activities/ContactBrowserActivity.java
@@ -23,7 +23,7 @@
 import com.android.contacts.interactions.ContactDeletionInteraction;
 import com.android.contacts.interactions.GroupDeletionDialogFragment;
 import com.android.contacts.interactions.GroupRenamingDialogFragment;
-import com.android.contacts.interactions.ImportExportInteraction;
+import com.android.contacts.interactions.ImportExportDialogFragment;
 import com.android.contacts.interactions.PhoneNumberInteraction;
 import com.android.contacts.list.ContactBrowseListContextMenuAdapter;
 import com.android.contacts.list.ContactBrowseListFragment;
@@ -112,7 +112,6 @@
 
     private PhoneNumberInteraction mPhoneNumberCallInteraction;
     private PhoneNumberInteraction mSendTextMessageInteraction;
-    private ImportExportInteraction mImportExportInteraction;
 
     private boolean mSearchInitiated;
 
@@ -733,7 +732,7 @@
                 return true;
             }
             case R.id.menu_import_export: {
-                getImportExportInteraction().startInteraction();
+                ImportExportDialogFragment.show(getFragmentManager());
                 return true;
             }
             case R.id.menu_accounts: {
@@ -793,9 +792,6 @@
         dialog = getSendTextMessageInteraction().onCreateDialog(id, bundle);
         if (dialog != null) return dialog;
 
-        dialog = getImportExportInteraction().onCreateDialog(id, bundle);
-        if (dialog != null) return dialog;
-
         return super.onCreateDialog(id, bundle);
     }
 
@@ -956,13 +952,6 @@
         return mSendTextMessageInteraction;
     }
 
-    private ImportExportInteraction getImportExportInteraction() {
-        if (mImportExportInteraction == null) {
-            mImportExportInteraction = new ImportExportInteraction(this);
-        }
-        return mImportExportInteraction;
-    }
-
     @Override
     public DialogManager getDialogManager() {
         return mDialogManager;
diff --git a/src/com/android/contacts/activities/DialtactsActivity.java b/src/com/android/contacts/activities/DialtactsActivity.java
index ae8f479..baae703 100644
--- a/src/com/android/contacts/activities/DialtactsActivity.java
+++ b/src/com/android/contacts/activities/DialtactsActivity.java
@@ -19,7 +19,7 @@
 import com.android.contacts.R;
 import com.android.contacts.calllog.CallLogFragment;
 import com.android.contacts.dialpad.DialpadFragment;
-import com.android.contacts.interactions.ImportExportInteraction;
+import com.android.contacts.interactions.ImportExportDialogFragment;
 import com.android.contacts.list.ContactListFilter;
 import com.android.contacts.list.ContactsIntentResolver;
 import com.android.contacts.list.ContactsRequest;
@@ -33,7 +33,6 @@
 import android.app.ActionBar.Tab;
 import android.app.ActionBar.TabListener;
 import android.app.Activity;
-import android.app.Dialog;
 import android.app.Fragment;
 import android.app.FragmentManager;
 import android.app.FragmentTransaction;
@@ -46,8 +45,8 @@
 import android.provider.CallLog.Calls;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.Contacts;
-import android.provider.Settings;
 import android.provider.ContactsContract.Intents.UI;
+import android.provider.Settings;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -86,7 +85,6 @@
     private CallLogFragment mCallLogFragment;
     private DefaultContactBrowseListFragment mContactsFragment;
     private DefaultContactBrowseListFragment mFavoritesFragment;
-    private ImportExportInteraction mImportExportInteraction;
 
     /**
      * The index of the tab that has last been manually selected (the user clicked on a tab).
@@ -541,7 +539,7 @@
             return true;
         }
         case R.id.menu_import_export: {
-            getImportExportInteraction().startInteraction();
+            ImportExportDialogFragment.show(getFragmentManager());
             return true;
         }
         case R.id.menu_accounts: {
@@ -557,18 +555,4 @@
             return super.onOptionsItemSelected(item);
         }
     }
-
-    @Override
-    protected Dialog onCreateDialog(int id, Bundle bundle) {
-        Dialog dialog = getImportExportInteraction().onCreateDialog(id, bundle);
-        if (dialog != null) return dialog;
-        return super.onCreateDialog(id, bundle);
-    }
-
-    private ImportExportInteraction getImportExportInteraction() {
-        if (mImportExportInteraction == null) {
-            mImportExportInteraction = new ImportExportInteraction(this);
-        }
-        return mImportExportInteraction;
-    }
 }
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index 88008a3..f3a4805 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -1286,7 +1286,7 @@
     }
 
     @Override
-    public void onAccountChosen(Account account) {
+    public void onAccountChosen(int requestCode, Account account) {
         createCopy(account);
     }
 
diff --git a/src/com/android/contacts/editor/SelectAccountDialogFragment.java b/src/com/android/contacts/editor/SelectAccountDialogFragment.java
index 67c5f6e..65370f5 100644
--- a/src/com/android/contacts/editor/SelectAccountDialogFragment.java
+++ b/src/com/android/contacts/editor/SelectAccountDialogFragment.java
@@ -53,8 +53,7 @@
             public void onClick(DialogInterface dialog, int which) {
                 dialog.dismiss();
 
-                final Listener target = (Listener) getTargetFragment();
-                target.onAccountChosen(accountAdapter.getItem(which));
+                onAccountSelected(accountAdapter.getItem(which));
             }
         };
 
@@ -67,12 +66,27 @@
     @Override
     public void onCancel(DialogInterface dialog) {
         super.onCancel(dialog);
-        final Listener target = (Listener) getTargetFragment();
-        target.onAccountSelectorCancelled();
+        final Fragment targetFragment = getTargetFragment();
+        if (targetFragment != null && targetFragment instanceof Listener) {
+            final Listener target = (Listener) targetFragment;
+            target.onAccountSelectorCancelled();
+        }
+    }
+
+    /**
+     * Calls {@link Listener#onAccountChosen(int, Account)} if the target fragment is castable
+     * to {@link Listener}. Subclasses can also overide to directly perform an operation
+     */
+    protected void onAccountSelected(Account account) {
+        final Fragment targetFragment = getTargetFragment();
+        if (targetFragment != null && targetFragment instanceof Listener) {
+            final Listener target = (Listener) targetFragment;
+            target.onAccountChosen(getTargetRequestCode(), account);
+        }
     }
 
     public interface Listener {
-        void onAccountChosen(Account account);
+        void onAccountChosen(int requestCode, Account account);
         void onAccountSelectorCancelled();
     }
 }
diff --git a/src/com/android/contacts/interactions/ImportExportInteraction.java b/src/com/android/contacts/interactions/ImportExportDialogFragment.java
similarity index 62%
rename from src/com/android/contacts/interactions/ImportExportInteraction.java
rename to src/com/android/contacts/interactions/ImportExportDialogFragment.java
index bd8ac16..4e22fa2 100644
--- a/src/com/android/contacts/interactions/ImportExportInteraction.java
+++ b/src/com/android/contacts/interactions/ImportExportDialogFragment.java
@@ -17,14 +17,16 @@
 package com.android.contacts.interactions;
 
 import com.android.contacts.R;
+import com.android.contacts.editor.SelectAccountDialogFragment;
 import com.android.contacts.model.AccountTypeManager;
 import com.android.contacts.util.AccountSelectionUtil;
 import com.android.contacts.vcard.ExportVCardActivity;
 
 import android.accounts.Account;
-import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.FragmentManager;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
@@ -35,7 +37,6 @@
 import android.provider.ContactsContract.Contacts;
 import android.telephony.TelephonyManager;
 import android.util.Log;
-import android.view.ContextThemeWrapper;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -46,70 +47,39 @@
 import java.util.List;
 
 /**
- * An interaction invoked to import/export contacts.
+ * An dialog invoked to import/export contacts.
  */
-public class ImportExportInteraction {
-
-    private static final String TAG = "ImportExportInteraction";
+public class ImportExportDialogFragment extends DialogFragment {
+    public static final String TAG = "ImportExportDialogFragment";
 
     private final String[] LOOKUP_PROJECTION = new String[] {
             Contacts.LOOKUP_KEY
     };
 
-    private final Context mContext;
-
-    public ImportExportInteraction(Context context) {
-        this.mContext = context;
+    /** Preferred way to show this dialog */
+    public static void show(FragmentManager fragmentManager) {
+        final ImportExportDialogFragment fragment = new ImportExportDialogFragment();
+        fragment.show(fragmentManager, ImportExportDialogFragment.TAG);
     }
 
-    /**
-     * Creates a {@link Dialog} that allows the user to choose between a bulk import
-     * and bulk export task across all contacts.
-     */
-    public void startInteraction() {
-        showDialog(R.id.dialog_import_export_options, null);
-    }
-
-    public Dialog onCreateDialog(int id, Bundle bundle) {
-        switch (id) {
-            case R.id.dialog_import_export_options: {
-                return createOptionsDialog();
-            }
-            case R.string.import_from_sim:
-            case R.string.import_from_sdcard: {
-                return AccountSelectionUtil.getSelectAccountDialog(mContext, id);
-            }
-            case R.id.dialog_sdcard_not_found: {
-                return new AlertDialog.Builder(mContext)
-                        .setTitle(R.string.no_sdcard_title)
-                        .setIconAttribute(android.R.attr.alertDialogIcon)
-                        .setMessage(R.string.no_sdcard_message)
-                        .setPositiveButton(android.R.string.ok, null).create();
-            }
-        }
-
-        return null;
-    }
-
-    private Dialog createOptionsDialog() {
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
         // Wrap our context to inflate list items using the correct theme
-        final Resources res = mContext.getResources();
-        final LayoutInflater dialogInflater = (LayoutInflater)mContext
+        final Resources res = getActivity().getResources();
+        final LayoutInflater dialogInflater = (LayoutInflater)getActivity()
                 .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
         // Adapter that shows a list of string resources
-        final ArrayAdapter<Integer> adapter = new ArrayAdapter<Integer>(mContext,
+        final ArrayAdapter<Integer> adapter = new ArrayAdapter<Integer>(getActivity(),
                 android.R.layout.select_dialog_item) {
             @Override
             public View getView(int position, View convertView, ViewGroup parent) {
-                if (convertView == null) {
-                    convertView = dialogInflater.inflate(android.R.layout.select_dialog_item,
-                            parent, false);
-                }
+                final TextView result = (TextView)(convertView != null ? convertView :
+                        dialogInflater.inflate(android.R.layout.select_dialog_item, parent, false));
 
-                final int resId = this.getItem(position);
-                ((TextView)convertView).setText(resId);
-                return convertView;
+                final int resId = getItem(position);
+                result.setText(resId);
+                return result;
             }
         };
 
@@ -128,6 +98,7 @@
 
         final DialogInterface.OnClickListener clickListener =
                 new DialogInterface.OnClickListener() {
+            @Override
             public void onClick(DialogInterface dialog, int which) {
                 dialog.dismiss();
 
@@ -139,8 +110,8 @@
                         break;
                     }
                     case R.string.export_to_sdcard: {
-                        Intent exportIntent = new Intent(mContext, ExportVCardActivity.class);
-                        mContext.startActivity(exportIntent);
+                        Intent exportIntent = new Intent(getActivity(), ExportVCardActivity.class);
+                        getActivity().startActivity(exportIntent);
                         break;
                     }
                     case R.string.share_visible_contacts: {
@@ -148,14 +119,13 @@
                         break;
                     }
                     default: {
-                        Log.e(TAG, "Unexpected resource: " +
-                                mContext.getResources().getResourceEntryName(resId));
+                        Log.e(TAG, "Unexpected resource: "
+                                + getActivity().getResources().getResourceEntryName(resId));
                     }
                 }
             }
         };
-
-        return new AlertDialog.Builder(mContext)
+        return new AlertDialog.Builder(getActivity())
                 .setTitle(R.string.dialog_import_export)
                 .setNegativeButton(android.R.string.cancel, null)
                 .setSingleChoiceItems(adapter, -1, clickListener)
@@ -163,13 +133,12 @@
     }
 
     private void doShareVisibleContacts() {
-
-        // TODO move the query into a loader
-        final Cursor cursor = mContext.getContentResolver().query(Contacts.CONTENT_URI,
+        // TODO move the query into a loader and do this in a background thread
+        final Cursor cursor = getActivity().getContentResolver().query(Contacts.CONTENT_URI,
                 LOOKUP_PROJECTION, Contacts.IN_VISIBLE_GROUP + "!=0", null, null);
         try {
             if (!cursor.moveToFirst()) {
-                Toast.makeText(mContext, R.string.share_error, Toast.LENGTH_SHORT).show();
+                Toast.makeText(getActivity(), R.string.share_error, Toast.LENGTH_SHORT).show();
                 return;
             }
 
@@ -188,7 +157,7 @@
             final Intent intent = new Intent(Intent.ACTION_SEND);
             intent.setType(Contacts.CONTENT_VCARD_TYPE);
             intent.putExtra(Intent.EXTRA_STREAM, uri);
-            mContext.startActivity(intent);
+            getActivity().startActivity(intent);
         } finally {
             cursor.close();
         }
@@ -199,19 +168,37 @@
         // - more than one accounts -> ask the user
         // - just one account -> use the account without asking the user
         // - no account -> use phone-local storage without asking the user
-        final AccountTypeManager accountTypes = AccountTypeManager.getInstance(mContext);
+        final AccountTypeManager accountTypes = AccountTypeManager.getInstance(getActivity());
         final List<Account> accountList = accountTypes.getAccounts(true);
         final int size = accountList.size();
         if (size > 1) {
-            showDialog(resId, null);
+            // Send over to the account selector
+            ImportExportAccountSelectorDialog.show(getFragmentManager(), resId);
             return;
         }
 
-        AccountSelectionUtil.doImport(mContext, resId, (size == 1 ? accountList.get(0) : null));
+        AccountSelectionUtil.doImport(getActivity(), resId,
+                (size == 1 ? accountList.get(0) : null));
     }
 
-    /* Visible for testing */
-    void showDialog(int dialogId, Bundle bundle) {
-        ((Activity)mContext).showDialog(dialogId, bundle);
+    /** Sub-Dialog for showing an account selector in case there are several accounts */
+    public static class ImportExportAccountSelectorDialog extends SelectAccountDialogFragment {
+        private static final String SELECTOR_TAG = "ImportExportAccountSelectorDialog";
+        private static final String BUNDLE_RES_ID = "resourceId";
+
+        public static void show(FragmentManager manager, int resId) {
+            final ImportExportAccountSelectorDialog dialog =
+                new ImportExportAccountSelectorDialog();
+            final Bundle bundle = new Bundle();
+            bundle.putInt(BUNDLE_RES_ID, resId);
+            dialog.setArguments(bundle);
+            dialog.show(manager, SELECTOR_TAG);
+        }
+
+        @Override
+        protected void onAccountSelected(Account account) {
+            final int resourceId = getArguments().getInt(BUNDLE_RES_ID);
+            AccountSelectionUtil.doImport(getActivity(), resourceId, account);
+        }
     }
 }
