import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.view.Window;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
+ case R.string.import_from_sim:
+ case R.string.import_from_sdcard: {
+ return AccountSelectionUtil.getSelectAccountDialog(this, id);
+ }
case R.id.dialog_sdcard_not_found: {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(R.string.no_sdcard_title)
import android.accounts.Account;
import android.app.AlertDialog;
+import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
}
}
- public static void displaySelectAccountDialog(Context context, int resId) {
- displaySelectAccountDialog(context, resId, null);
+ public static Dialog getSelectAccountDialog(Context context, int resId) {
+ return getSelectAccountDialog(context, resId, null);
}
- public static void displaySelectAccountDialog(Context context, int resId,
+ public static Dialog getSelectAccountDialog(Context context, int resId,
DialogInterface.OnCancelListener onCancelListener) {
final Sources sources = Sources.getInstance(context);
final List<Account> writableAccountList = sources.getAccounts(true);
AccountSelectedListener accountSelectedListener =
new AccountSelectedListener(context, writableAccountList, resId);
- new AlertDialog.Builder(context)
+ return new AlertDialog.Builder(context)
.setTitle(R.string.dialog_new_contact_account)
.setSingleChoiceItems(accountAdapter, 0, accountSelectedListener)
.setOnCancelListener(accountSelectedListener)
- .show();
+ .create();
}
public static void doImport(Context context, int resId, Account account) {