Example usage for android.app AlertDialog.Builder setIcon

List of usage examples for android.app AlertDialog.Builder setIcon

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setIcon.

Prototype

public void setIcon(Drawable icon) 

Source Link

Usage

From source file:com.xperia64.timidityae.PlaylistFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    if (!gotPlaylists) {
        gotPlaylists = true;/*from w  w w.j  a v  a  2 s  .com*/
        getPlaylists(null);
    }
    getListView().setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> arg0, View arg1, final int pos, long id) {
            if (!mode) {
                AlertDialog.Builder builderSingle = new AlertDialog.Builder(getActivity());
                builderSingle.setIcon(R.drawable.ic_launcher);
                builderSingle.setTitle(getActivity().getResources()
                        .getString((pos == 0) ? R.string.plist_save2 : R.string.plist_mod));
                builderSingle.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();

                    }
                });
                if (pos != 0) {
                    builderSingle.setNeutralButton(getResources().getString(R.string.plist_del),
                            new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    AlertDialog.Builder builderDouble = new AlertDialog.Builder(getActivity())
                                            .setIcon(R.drawable.ic_launcher)
                                            .setTitle(String.format(
                                                    getActivity().getResources().getString(R.string.plist_del2),
                                                    fname.get(pos)));
                                    builderDouble.setPositiveButton(android.R.string.yes,
                                            new DialogInterface.OnClickListener() {

                                                @Override
                                                public void onClick(DialogInterface dialog, int which) {
                                                    File f = new File(path.get(pos));
                                                    if (f.exists()) {
                                                        String[] x = null;
                                                        try {
                                                            new FileOutputStream(path.get(pos), true).close();
                                                        } catch (FileNotFoundException e) {
                                                            x = Globals.getDocFilePaths(getActivity(),
                                                                    f.getAbsolutePath());
                                                        } catch (IOException e) {
                                                            e.printStackTrace();
                                                        }

                                                        if (x != null) {
                                                            Globals.tryToDeleteFile(getActivity(),
                                                                    path.get(pos));
                                                        } else {
                                                            f.delete();
                                                        }
                                                    }
                                                    getPlaylists(null);
                                                    dialog.dismiss();
                                                }
                                            });
                                    builderDouble.setNegativeButton(android.R.string.no,
                                            new DialogInterface.OnClickListener() {

                                                @Override
                                                public void onClick(DialogInterface dialog, int which) {
                                                    dialog.dismiss();
                                                }
                                            });
                                    builderDouble.show();
                                }
                            });
                    builderSingle.setPositiveButton(getResources().getString(R.string.plist_ren),
                            new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());

                                    alert.setTitle(String.format(getResources().getString(R.string.plist_ren2),
                                            fname.get(pos)));

                                    final EditText input = new EditText(getActivity());
                                    alert.setView(input);

                                    alert.setPositiveButton(android.R.string.ok,
                                            new DialogInterface.OnClickListener() {
                                                public void onClick(DialogInterface dialog, int whichButton) {
                                                    String value = input.getText().toString();
                                                    File f = new File(path.get(pos));
                                                    File f2 = new File(path.get(pos).substring(0,
                                                            path.get(pos).lastIndexOf('/') + 1) + value
                                                            + ".tpl");
                                                    if (f.exists()) {
                                                        if (f2.exists()) {
                                                            Toast.makeText(getActivity(),
                                                                    getResources().getString(R.string.plist_ex),
                                                                    Toast.LENGTH_SHORT).show();
                                                        } else {
                                                            String[] x = null;
                                                            try {
                                                                new FileOutputStream(f.getAbsolutePath(), true)
                                                                        .close();
                                                            } catch (FileNotFoundException e) {
                                                                x = Globals.getDocFilePaths(getActivity(),
                                                                        f.getAbsolutePath());
                                                            } catch (IOException e) {
                                                                e.printStackTrace();
                                                            }

                                                            if (x != null) {
                                                                Globals.renameDocumentFile(getActivity(),
                                                                        f.getAbsolutePath(),
                                                                        f2.getAbsolutePath()
                                                                                .substring(f2.getAbsolutePath()
                                                                                        .indexOf(x[1])
                                                                                        + x[1].length()));
                                                            } else {
                                                                f.renameTo(f2);
                                                            }

                                                        }
                                                    } else
                                                        Toast.makeText(getActivity(),
                                                                getResources().getString(R.string.plist_pnf),
                                                                Toast.LENGTH_SHORT).show();
                                                    getPlaylists(null);
                                                    dialog.dismiss();
                                                }

                                            });

                                    alert.setNegativeButton(android.R.string.cancel,
                                            new DialogInterface.OnClickListener() {
                                                public void onClick(DialogInterface dialog, int whichButton) {
                                                    dialog.dismiss();
                                                }
                                            });

                                    alert.show();
                                }
                            });
                } else {

                    final EditText input2 = new EditText(getActivity());
                    builderSingle.setView(input2);
                    builderSingle.setPositiveButton(getResources().getString(R.string.plist_save),
                            new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    if (input2.getText() != null) {
                                        if (!TextUtils.isEmpty(input2.getText().toString())) {
                                            tmpName = playlistDir + "/" + input2.getText().toString() + ".tpl";
                                            vola = currPlist;
                                            write();
                                        }
                                    }
                                }
                            });
                }
                builderSingle.show();
                return true;
            } else if (!plistName.equals("CURRENT")) {
                AlertDialog.Builder builderSingle = new AlertDialog.Builder(getActivity());

                builderSingle.setIcon(R.drawable.ic_launcher);
                builderSingle.setTitle(getResources().getString(R.string.plist_modit));
                final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(getActivity(),
                        android.R.layout.select_dialog_item);
                arrayAdapter.add(getResources().getString(R.string.plist_ds));
                arrayAdapter.add(getResources().getString(R.string.plist_addcsh));
                arrayAdapter.add(getResources().getString(R.string.plist_addsh));
                arrayAdapter.add(getResources().getString(R.string.plist_addfh));
                arrayAdapter.add(getResources().getString(R.string.plist_addfth));
                builderSingle.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });

                builderSingle.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        vola = parsePlist(tmpName = plistName);
                        loki = pos;
                        switch (which) {
                        case 0:
                            setItem(null, -1);
                            write();
                            break;
                        case 1:
                            if (((TimidityActivity) getActivity()).currSongName != null) {
                                setItem(((TimidityActivity) getActivity()).currSongName, 0);
                                write();
                            }
                            break;
                        case 2:
                            new FileBrowserDialog().create(0,
                                    (Globals.showVideos ? Globals.musicVideoFiles : Globals.musicFiles),
                                    PlaylistFragment.this, getActivity(), getActivity().getLayoutInflater(),
                                    false, Globals.defaultFolder,
                                    getActivity().getResources().getString(R.string.fb_add));
                            break;
                        case 3:
                            new FileBrowserDialog().create(1, null, PlaylistFragment.this, getActivity(),
                                    getActivity().getLayoutInflater(), false, Globals.defaultFolder,
                                    getActivity().getResources().getString(R.string.fb_add));
                            break;
                        case 4:
                            new FileBrowserDialog().create(2, null, PlaylistFragment.this, getActivity(),
                                    getActivity().getLayoutInflater(), false, Globals.defaultFolder,
                                    getActivity().getResources().getString(R.string.fb_add));
                            break;
                        }
                    }
                });
                builderSingle.show();
                return true;
            }
            return true;
        }
    });
}

From source file:com.capstonecontrol.AccountsActivity.java

/**
 * Sets up the 'connect' screen content.
 *///  w  w  w  . ja v a 2  s.c om
private void setConnectScreenContent() {
    List<String> accounts = getGoogleAccounts();
    if (accounts.size() == 0) {
        // Show a dialog and invoke the "Add Account" activity if requested
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setMessage(R.string.needs_account);
        builder.setPositiveButton(R.string.add_account, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));
            }
        });
        builder.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.setIcon(android.R.drawable.stat_sys_warning);
        builder.setTitle(R.string.attention);
        builder.show();
    } else {
        final ListView listView = (ListView) findViewById(R.id.select_account);
        listView.setAdapter(new ArrayAdapter<String>(mContext, R.layout.account, accounts));
        listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        listView.setItemChecked(mAccountSelectedPosition, true);

        final Button connectButton = (Button) findViewById(R.id.connect);
        connectButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                CapstoneControlActivity.userChanged = true;
                // Set "connecting" status
                SharedPreferences prefs = Util.getSharedPreferences(mContext);
                prefs.edit().putString(Util.CONNECTION_STATUS, Util.CONNECTING).commit();
                // Get account name
                mAccountSelectedPosition = listView.getCheckedItemPosition();
                TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition);
                // Register
                register((String) account.getText());
                // finish();
                // clear the module list so that a new one will get found
                CapstoneControlActivity.modules.clear();
                // instead of finish() go back to the AccountsActivity for
                // new login.
                CapstoneControlActivity.googleUserName = (String) account.getText();
                Intent myIntent = new Intent(v.getContext(), SplashActivity.class);
                startActivity(myIntent);
                myIntent = new Intent(v.getContext(), CapstoneControlActivity.class);
                startActivity(myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
            }
        });
    }
}

From source file:com.listomate.activities.AccountsActivity.java

/**
 * Sets up the 'connect' screen content.
 *//*  w w  w  .ja v  a 2 s  .com*/
private void setConnectScreenContent() {
    List<String> accounts = getGoogleAccounts();
    if (accounts.size() == 0) {
        // Show a dialog and invoke the "Add Account" activity if requested
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setMessage(R.string.needs_account);
        builder.setPositiveButton(R.string.add_account, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));
            }
        });
        builder.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.setIcon(android.R.drawable.stat_sys_warning);
        builder.setTitle(R.string.attention);
        builder.show();
    } else {
        final ListView listView = (ListView) findViewById(R.id.select_account);
        listView.setAdapter(new ArrayAdapter<String>(mContext, R.layout.account, accounts));
        listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        listView.setItemChecked(mAccountSelectedPosition, true);

        final Button connectButton = (Button) findViewById(R.id.connect);
        connectButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                // Register in the background and terminate the activity
                mAccountSelectedPosition = listView.getCheckedItemPosition();
                TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition);
                register((String) account.getText());
                finish();
            }
        });

        final Button exitButton = (Button) findViewById(R.id.exit);
        exitButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                finish();
            }
        });
    }
}

From source file:tv.day9.apk.fragment.ConnectFragment.java

/**
 * Create the add account dialog./*from   w ww  .java  2s  . c  o  m*/
 */
private void createAddAcountDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setMessage(R.string.needs_account);
    builder.setNegativeButton(R.string.btn_skip, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            UIUtils.removeC2dmPreferences(sharedPreferences);
            getActivity().finish();
        }
    });
    builder.setPositiveButton(R.string.add_account, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
        }
    });
    builder.setIcon(android.R.drawable.stat_sys_warning);
    builder.setTitle(R.string.attention);
    builder.show();
}

From source file:com.moro.synapsemod.MainActivity.java

private void dialogo_restaurar() {

    File ficheros = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator
            + getString(R.string.dir_backups));
    FileFilter ff = new FileFilter() {
        @Override/*from   w ww. ja va  2s.c  om*/
        public boolean accept(File pathname) {
            String ruta;
            if (pathname.isFile()) {
                ruta = pathname.getAbsolutePath().toLowerCase();
                //compruebo que el nombre completo, con ruta, del archivo tiene la extensin que yo uso en la apk para backups
                if (ruta.contains("." + getString(R.string.ext_backups))) {
                    return true;
                }
            }
            return false;
        }
    };
    File fa[] = ficheros.listFiles(ff);
    if (fa.length == 0) {
        Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.no_backups),
                Toast.LENGTH_LONG);
        toast.show();
    } else {

        AdapterBackups ab = new AdapterBackups();
        ab.AdapterBackups(this, fa);
        ListView lista = new ListView(this);
        lista.setAdapter(ab);
        lista.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                TextView tv = (TextView) view.findViewById(android.R.id.text1);
                String archivo = tv.getText().toString();
                dlg_restaurar.dismiss();
                dlg_restaurar = null;
                File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator
                        + getString(R.string.dir_backups) + archivo + "." + getString(R.string.ext_backups));
                //compruebo que fsicamente existe de verdad (otra vez)
                if (f.exists())
                    confirmar_restaurar(archivo);
                else {
                    Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.no_backups),
                            Toast.LENGTH_LONG);
                    toast.show();
                }
            }
        });
        AlertDialog.Builder abd = new AlertDialog.Builder(this);
        abd.setTitle(R.string.dlg_restore_title);
        abd.setMessage(R.string.dlg_restore_message);
        abd.setIcon(R.drawable.ic_action_restore);
        abd.setView(lista);
        dlg_restaurar = abd.create();
        dlg_restaurar.show();
    }

}

From source file:crackerjack.education.Indijisites.StartUp.java

@Override
public void onInfoWindowClick(Marker marker) {

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LayoutInflater inflater = getLayoutInflater();
    final View myView = inflater.inflate(R.layout.description_popup, null);
    builder.setTitle(marker.getTitle());

    // If you need more things displayed in the popup, extend the XML :D

    if (marker.equals(mBrisbane)) {

        builder.setMessage(R.string.desc_bris);

    } else if (marker.equals(mMurray_River)) {

        builder.setMessage(R.string.murray_river_desc);

    } else if (marker.equals(mPurnululu)) {

        builder.setMessage(R.string.Purnululu_desc);
        builder.setIcon(R.drawable.rock_art);

    } else if (marker.equals(mSandy_National)) {

        builder.setMessage(R.string.sandy_national_desc);

    } else if (marker.equals(mRed_Hands)) {

        builder.setMessage(R.string.red_hands_desc);

    } else if (marker.equals(mBirrigai)) {

        builder.setMessage(R.string.birrigai_desc);

    } else if (marker.equals(mChillagoe)) {

        builder.setMessage(R.string.chillagoe_desc);

    } else if (marker.equals(mMtCameron)) {

        builder.setMessage(R.string.mtcameron_desc);

    } else if (marker.equals(mInnamincka)) {

        builder.setMessage(R.string.innamincka_desc);

    } else if (marker.equals(mNullPlain)) {

        builder.setMessage(R.string.nullplain_desc);

    } else if (marker.equals(mUluru)) {

        builder.setMessage(R.string.uluru_desc);

    }// w w  w .j  a  va  2 s .  c o  m

    builder.setView(myView);
    AlertDialog alert = builder.create();
    alert.show();

}

From source file:com.pranavpandey.smallapp.permission.PermissionWriteSystemSettings.java

private void buildPermissionsDialog() {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
    View view = getLayoutInflater().inflate(R.layout.sas_dialog_permission, new LinearLayout(this), false);
    ViewGroup frame = (ViewGroup) view.findViewById(R.id.permission_frame);

    String label = getApplicationInfo().loadLabel(getPackageManager()).toString();
    ((TextView) view.findViewById(R.id.permission_message)).setText(
            String.format(getString(R.string.sas_format_next_line), getString(R.string.sas_perm_request_desc),
                    String.format(getString(R.string.sas_perm_write_system_settings_info), label)));

    frame.addView(new PermissionItem(this, ContextCompat.getDrawable(this, R.drawable.sas_ic_menu_settings),
            getString(R.string.sas_perm_write_system_settings),
            getString(R.string.sas_perm_write_system_settings_desc)));

    try {/* ww w  .  j av  a2 s .  co  m*/
        alertDialogBuilder.setIcon(
                DynamicTheme.createDialogIcon(this, getPackageManager().getApplicationIcon(getPackageName())));
    } catch (Exception e) {
        e.printStackTrace();
    }
    alertDialogBuilder.setTitle(label)
            .setPositiveButton(R.string.sas_perm_continue, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    openPermissionSettings(Settings.ACTION_MANAGE_WRITE_SETTINGS);
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    finishPermissionsChecker();
                }
            }).setCancelable(false);

    final AlertDialog dialog = alertDialogBuilder.create();
    dialog.setView(view, 0, SmallUtils.getDialogTopPadding(this), 0, 0);

    showPermissionDialog(dialog);
}

From source file:com.shafiq.mytwittle.view.HomeActivity.java

private void showFreeForLifeError() {
    AlertDialog.Builder builder = new AlertDialog.Builder(HomeActivity.this);

    builder.setMessage(getString(R.string.free_for_life_error));
    builder.setIcon(0);

    builder.setPositiveButton("OK", new Dialog.OnClickListener() {

        @Override/*from   w  w  w .jav a2s  . c  o  m*/
        public void onClick(DialogInterface arg0, int arg1) {

        }

    });
}

From source file:es.ugr.swad.swadroid.modules.downloads.DownloadsManager.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
        Intent activity;//from  w w  w.  j  a v a 2s .  c  o  m

        switch (requestCode) {
        // After get the list of courses, a dialog is launched to choice the
        // course
        case Constants.DIRECTORY_TREE_REQUEST_CODE:
            tree = data.getStringExtra("tree");
            if (!refresh) {
                setMainView();
            } else {
                refresh = false;
                if (!noConnectionView)
                    refresh();
                else
                    setMainView();
            }
            break;
        case Constants.GETFILE_REQUEST_CODE:
            Log.d(TAG, "Correct get file");
            //if the sd card is not busy, the file can be downloaded
            if (this.checkMediaAvailability() == 2) {
                Log.i(TAG, "External storage is available");
                String url = data.getExtras().getString("link");
                downloadFile(Constants.DIRECTORY_SWADROID, url, fileSize);
                //Toast.makeText(this, chosenNodeName +" "+ this.getResources().getString(R.string.notificationDownloadTitle) , Toast.LENGTH_LONG).show();
            } else { //if the sd card is busy, it shows a alert dialog
                Log.i(TAG, "External storage is NOT available");
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                AlertDialog dialog;
                builder.setTitle(R.string.sdCardBusyTitle);
                builder.setMessage(R.string.sdCardBusy);
                builder.setIcon(android.R.drawable.ic_dialog_alert);
                builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.dismiss();
                    }
                });
                dialog = builder.create();
                dialog.show();
            }
            break;
        case Constants.GETMARKS_REQUEST_CODE:
            activity = new Intent(this, Marks.class);
            activity.putExtra("content", GetMarks.getMarks());
            startActivityForResult(activity, Constants.MARKS_REQUEST_CODE);
            break;
        case Constants.GROUPS_REQUEST_CODE:
            groupsRequested = true;
            myGroups = getFilteredGroups(); //only groups where the user is enrolled.
            this.loadGroupsSpinner(myGroups);
            if (myGroups.size() == 0)
                requestDirectoryTree();
            break;
        case Constants.GROUPTYPES_REQUEST_CODE:
            activity = new Intent(this, Groups.class);
            activity.putExtra("courseCode", Courses.getSelectedCourseCode());
            startActivityForResult(activity, Constants.GROUPS_REQUEST_CODE);
            break;
        }

    } else {
        if (refresh) {
            refresh = false;
        }
    }
}

From source file:com.masteriti.manager.AccountsActivity.java

/**
 * Sets up the 'connect' screen content.
 */// w  w  w .j a  va  2 s .  c  o m
private void setConnectScreenContent() {
    List<String> accounts = getGoogleAccounts();
    if (accounts.size() == 0) {
        // Show a dialog and invoke the "Add Account" activity if requested
        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setMessage(R.string.needs_account);
        builder.setPositiveButton(R.string.add_account, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));
            }
        });
        builder.setNegativeButton(R.string.skip, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        builder.setIcon(android.R.drawable.stat_sys_warning);
        builder.setTitle(R.string.attention);
        builder.show();
    } else {
        final ListView listView = (ListView) findViewById(R.id.select_account);
        listView.setAdapter(new ArrayAdapter<String>(mContext, R.layout.account, accounts));
        listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        listView.setItemChecked(mAccountSelectedPosition, true);

        final Button connectButton = (Button) findViewById(R.id.connect);
        connectButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // Set "connecting" status
                SharedPreferences prefs = Util.getSharedPreferences(mContext);
                prefs.edit().putString(Util.CONNECTION_STATUS, Util.CONNECTING).commit();
                // Get account name
                mAccountSelectedPosition = listView.getCheckedItemPosition();
                TextView account = (TextView) listView.getChildAt(mAccountSelectedPosition);
                // Register
                register((String) account.getText());
                finish();
            }
        });
    }
}