Example usage for android.app Dialog setTitle

List of usage examples for android.app Dialog setTitle

Introduction

In this page you can find the example usage for android.app Dialog setTitle.

Prototype

public void setTitle(@StringRes int titleId) 

Source Link

Document

Set the title text for this dialog's window.

Usage

From source file:com.nononsenseapps.notepad.MainActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DELETE_LIST:
        final Dialog deleteDialog = new Dialog(this);
        deleteDialog.setContentView(R.layout.delete_list_dialog);
        deleteDialog.setTitle(R.string.menu_deletelist);

        Button dYesButton = (Button) deleteDialog.findViewById(R.id.d_dialog_yes);
        dYesButton.setOnClickListener(new OnClickListener() {
            @Override//from  w  w  w . jav a2 s.c  om
            public void onClick(View v) {
                deleteCurrentList();
                deleteDialog.dismiss();
            }
        });

        Button dNoButton = (Button) deleteDialog.findViewById(R.id.d_dialog_no);
        dNoButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                deleteDialog.cancel();
            }
        });
        return deleteDialog;
    case CREATE_LIST:
        final Dialog dialog = new Dialog(this);
        dialog.setContentView(R.layout.create_list_dialog);
        dialog.setTitle(R.string.menu_createlist);

        EditText title = (EditText) dialog.findViewById(R.id.editTitle);
        title.setText("");

        Button yesButton = (Button) dialog.findViewById(R.id.dialog_yes);
        yesButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                EditText title = (EditText) dialog.findViewById(R.id.editTitle);
                createList(title.getText().toString());
                title.setText("");
                dialog.dismiss();
            }
        });

        Button noButton = (Button) dialog.findViewById(R.id.dialog_no);
        noButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                getActionBar().setSelectedNavigationItem(currentListPos);
                dialog.cancel();
            }
        });
        return dialog;
    case RENAME_LIST:
        final Dialog renameDialog = new Dialog(this);
        renameDialog.setContentView(R.layout.rename_list_dialog);
        renameDialog.setTitle(R.string.menu_renamelist);

        CharSequence currentTitle = "";
        if (mSectionsPagerAdapter != null)
            currentTitle = mSectionsPagerAdapter.getPageTitle(currentListPos);

        EditText renameTitle = (EditText) renameDialog.findViewById(R.id.renameTitle);
        renameTitle.setText(currentTitle);

        Button rYesButton = (Button) renameDialog.findViewById(R.id.r_dialog_yes);
        rYesButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                EditText renameTitle = (EditText) renameDialog.findViewById(R.id.renameTitle);
                renameList(renameTitle.getText().toString());
                renameTitle.setText("");
                renameDialog.dismiss();
            }
        });

        Button rNoButton = (Button) renameDialog.findViewById(R.id.r_dialog_no);
        rNoButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                renameDialog.cancel();
            }
        });
        return renameDialog;

    default:
        return null;
    }
}

From source file:de.mkrtchyan.recoverytools.RecoveryTools.java

public void createBackup(final boolean RecoveryBackup) {
    String prefix;//from  w  ww. j  a v  a  2  s .c o  m
    String CurrentName;
    String EXT;
    if (RecoveryBackup) {
        prefix = "recovery";
        EXT = mDevice.getRecoveryExt();
        CurrentName = mDevice.getRecoveryVersion();
    } else {
        prefix = "kernel";
        EXT = mDevice.getKernelExt();
        CurrentName = mDevice.getKernelVersion();
    }
    final Dialog dialog = new Dialog(mContext);
    dialog.setTitle(R.string.setname);
    dialog.setContentView(R.layout.dialog_input);
    final Button bGoBackup = (Button) dialog.findViewById(R.id.bGoBackup);
    final EditText etFileName = (EditText) dialog.findViewById(R.id.etFileName);
    final CheckBox optName = (CheckBox) dialog.findViewById(R.id.cbOptInput);
    final String NameHint = prefix + "-from-" + Calendar.getInstance().get(Calendar.DATE) + "-"
            + Calendar.getInstance().get(Calendar.MONTH) + "-" + Calendar.getInstance().get(Calendar.YEAR) + "-"
            + Calendar.getInstance().get(Calendar.HOUR) + ":" + Calendar.getInstance().get(Calendar.MINUTE)
            + EXT;
    optName.setText(CurrentName);
    optName.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            etFileName.setEnabled(!optName.isChecked());
        }
    });

    etFileName.setHint(NameHint);
    bGoBackup.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String EXT;
            File Path;
            final int JOB;
            if (RecoveryBackup) {
                EXT = mDevice.getRecoveryExt();
                Path = PathToRecoveryBackups;
                JOB = FlashUtil.JOB_BACKUP_RECOVERY;
            } else {
                EXT = mDevice.getKernelExt();
                Path = PathToKernelBackups;
                JOB = FlashUtil.JOB_BACKUP_KERNEL;
            }

            String Name = "";
            if (optName.isChecked()) {
                Name = optName.getText().toString() + EXT;
            } else {
                if (etFileName.getText() != null && !etFileName.getText().toString().equals("")) {
                    Name = etFileName.getText().toString();
                }

                if (Name.equals("")) {
                    Name = String.valueOf(etFileName.getHint());
                }

                if (!Name.endsWith(EXT)) {
                    Name = Name + EXT;
                }
            }

            final File fBACKUP = new File(Path, Name);
            Runnable rBackup = new Runnable() {
                @Override
                public void run() {
                    FlashUtil BackupCreator = new FlashUtil(mShell, mContext, mDevice, fBACKUP, JOB);
                    BackupCreator.setRunAtEnd(ReloadBackupDrawer);
                    BackupCreator.execute();
                }
            };
            if (fBACKUP.exists()) {
                Toast.makeText(mContext, R.string.backupalready, Toast.LENGTH_SHORT).show();
            } else {
                rBackup.run();
            }
            dialog.dismiss();

        }
    });
    dialog.show();
}

From source file:de.mkrtchyan.recoverytools.RecoveryTools.java

private void showFlashRecoveryDialog() {
    final Dialog FlashRecoveryDialog = new Dialog(mContext);
    LayoutInflater inflater = getLayoutInflater();
    FlashRecoveryDialog.setTitle(R.string.flash_options);
    try {/* www .  ja  v a 2s .c om*/
        final ScrollView RecoveryLayout = (ScrollView) inflater.inflate(R.layout.recovery_dialog, null);
        LinearLayout layout = (LinearLayout) RecoveryLayout.getChildAt(0);

        FlashRecoveryDialog.setContentView(RecoveryLayout);
        if (!mDevice.isCwmSupported()) {
            layout.removeView(FlashRecoveryDialog.findViewById(R.id.bCWM));
        }
        if (!mDevice.isTwrpSupported()) {
            layout.removeView(FlashRecoveryDialog.findViewById(R.id.bTWRP));
        }
        if (!mDevice.isPhilzSupported()) {
            layout.removeView(FlashRecoveryDialog.findViewById(R.id.bPHILZ));
        }

        FlashRecoveryDialog.show();
    } catch (NullPointerException e) {
        Notifyer.showExceptionToast(mContext, TAG, e);
    }
}

From source file:de.mkrtchyan.recoverytools.RecoveryTools.java

public void showPopup(int Menu, final View v) {
    PopupMenu popup = new PopupMenu(mContext, v);
    popup.getMenuInflater().inflate(Menu, popup.getMenu());
    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override/* www.j  a v  a  2  s . c  o m*/
        public boolean onMenuItemClick(MenuItem menuItem) {
            try {
                final String text = ((TextView) v).getText().toString();

                final Dialog dialog = new Dialog(mContext);
                dialog.setTitle(R.string.setname);
                dialog.setContentView(R.layout.dialog_input);
                final Button bGo = (Button) dialog.findViewById(R.id.bGoBackup);
                final EditText etFileName = (EditText) dialog.findViewById(R.id.etFileName);
                final File Backup = new File(PathToRecoveryBackups, text);

                switch (menuItem.getItemId()) {
                case R.id.iReboot:
                    mToolbox.reboot(Toolbox.REBOOT_REBOOT);
                    return true;
                case R.id.iRebootRecovery:
                    mToolbox.reboot(Toolbox.REBOOT_RECOVERY);
                    return true;
                case R.id.iRebootBootloader:
                    mToolbox.reboot(Toolbox.REBOOT_BOOTLOADER);
                    return true;
                case R.id.iRestoreRecovery:
                    new FlashUtil(mShell, mContext, mDevice, new File(PathToRecoveryBackups, text),
                            FlashUtil.JOB_RESTORE_RECOVERY).execute();
                    return true;
                case R.id.iRenameRecovery:
                    etFileName.setHint(text);
                    bGo.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {

                            String Name;
                            if (etFileName.getText() != null && !etFileName.getText().toString().equals("")) {
                                Name = etFileName.getText().toString();
                            } else {
                                Name = String.valueOf(etFileName.getHint());
                            }

                            if (!Name.endsWith(mDevice.getRecoveryExt())) {
                                Name = Name + mDevice.getRecoveryExt();
                            }

                            final File renamedBackup = new File(PathToRecoveryBackups, Name);

                            if (renamedBackup.exists()) {
                                Toast.makeText(mContext, R.string.backupalready, Toast.LENGTH_SHORT).show();
                            } else {
                                if (Backup.renameTo(renamedBackup)) {
                                    loadBackupDrawer();
                                }
                            }
                            dialog.dismiss();
                        }
                    });
                    dialog.show();
                    return true;
                case R.id.iDeleteRecoveryBackup:
                    if (((TextView) v).getText() != null) {
                        if (new File(PathToRecoveryBackups, text).delete()) {
                            Toast.makeText(mContext, String.format(mContext.getString(R.string.bak_deleted),
                                    ((TextView) v).getText()), Toast.LENGTH_SHORT).show();
                            loadBackupDrawer();
                        }
                    }
                    return true;
                case R.id.iRestoreKernel:
                    new FlashUtil(mShell, mContext, mDevice, new File(PathToKernelBackups, text),
                            FlashUtil.JOB_RESTORE_KERNEL).execute();
                    return true;
                case R.id.iRenameKernel:
                    etFileName.setHint(text);
                    bGo.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {

                            String Name;
                            if (etFileName.getText() != null && !etFileName.getText().toString().equals("")) {
                                Name = etFileName.getText().toString();
                            } else {
                                Name = String.valueOf(etFileName.getHint());
                            }

                            if (!Name.endsWith(mDevice.getKernelExt())) {
                                Name = Name + mDevice.getKernelExt();
                            }

                            final File renamedBackup = new File(PathToKernelBackups, Name);

                            if (renamedBackup.exists()) {
                                Toast.makeText(mContext, R.string.backupalready, Toast.LENGTH_SHORT).show();
                            } else {
                                if (Backup.renameTo(renamedBackup)) {
                                    loadBackupDrawer();
                                }
                            }
                            dialog.dismiss();

                        }
                    });
                    dialog.show();
                    return true;
                case R.id.iDeleteKernelBackup:
                    if (((TextView) v).getText() != null) {
                        if (new File(PathToKernelBackups, text).delete()) {
                            Toast.makeText(mContext, String.format(mContext.getString(R.string.bak_deleted),
                                    ((TextView) v).getText()), Toast.LENGTH_SHORT).show();
                            loadBackupDrawer();
                        }
                    }
                    return true;
                default:
                    return false;
                }
            } catch (Exception e) {
                return false;
            }
        }
    });
    popup.show();
}

From source file:reportsas.com.formulapp.Formulario.java

public void btnScan_click() {
    if (parametroScan == null) {
        callScaner();/*from www.  ja  v  a2  s .  c o m*/
    } else {
        final Dialog dialog = new Dialog(this);
        dialog.setContentView(R.layout.dialog_scaner);
        dialog.setTitle("Lectura Codigo  de Barras");

        TextView textoS = (TextView) dialog.findViewById(R.id.tvScan);
        Button Button1 = (Button) dialog.findViewById(R.id.NuevoScan);
        Button Button2 = (Button) dialog.findViewById(R.id.btn_close);

        textoS.setText(parametroScan.getValor());

        Button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callScaner();
                dialog.dismiss();
            }
        });

        Button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                dialog.dismiss();
            }
        });

        dialog.show();
    }

}

From source file:reportsas.com.formulapp.Formulario.java

public void CapturaF() {
    if (parametroCam == null) {

        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(intent, 1);

    } else {/* w  w  w.  java  2s . c  o m*/

        final Dialog dialog = new Dialog(this);
        dialog.setContentView(R.layout.dialog_imagen);
        dialog.setTitle("Captura de Formulario");
        byte[] decodedByte = Base64.decode(parametroCam.getValor(), 0);

        ImageView imageview = (ImageView) dialog.findViewById(R.id.ImaVcaptura);
        Button Button1 = (Button) dialog.findViewById(R.id.NuevaToma);
        Button Button2 = (Button) dialog.findViewById(R.id.btn_cerrar);

        imageview.setImageBitmap(BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length));
        Button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                startActivityForResult(intent, 1);
                dialog.dismiss();
            }
        });

        Button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                dialog.dismiss();
            }
        });

        dialog.show();

    }

}

From source file:org.connectbot.ConsoleActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    TerminalView view = adapter.getCurrentTerminalView();
    final boolean activeTerminal = view != null;
    boolean sessionOpen = false;
    boolean disconnected = false;
    boolean canForwardPorts = false;

    if (activeTerminal) {
        TerminalBridge bridge = view.bridge;
        sessionOpen = bridge.isSessionOpen();
        disconnected = bridge.isDisconnected();
        canForwardPorts = bridge.canFowardPorts();
    }/*  w w w  . ja v a2  s  . c o m*/

    menu.setQwertyMode(true);

    disconnect = menu.add(R.string.list_host_disconnect);
    if (hardKeyboard)
        disconnect.setAlphabeticShortcut('w');
    if (!sessionOpen && disconnected)
        disconnect.setTitle(R.string.console_menu_close);
    disconnect.setEnabled(activeTerminal);
    disconnect.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
    disconnect.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        public boolean onMenuItemClick(MenuItem item) {
            // disconnect or close the currently visible session
            TerminalView terminalView = adapter.getCurrentTerminalView();
            TerminalBridge bridge = terminalView.bridge;

            bridge.dispatchDisconnect(true);
            return true;
        }
    });

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        copy = menu.add(R.string.console_menu_copy);
        if (hardKeyboard)
            copy.setAlphabeticShortcut('c');
        MenuItemCompat.setShowAsAction(copy, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
        copy.setIcon(R.drawable.ic_action_copy);
        copy.setEnabled(activeTerminal);
        copy.setOnMenuItemClickListener(new OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
                adapter.getCurrentTerminalView().startPreHoneycombCopyMode();
                Toast.makeText(ConsoleActivity.this, getString(R.string.console_copy_start), Toast.LENGTH_LONG)
                        .show();
                return true;
            }
        });
    }

    paste = menu.add(R.string.console_menu_paste);
    if (hardKeyboard)
        paste.setAlphabeticShortcut('v');
    MenuItemCompat.setShowAsAction(paste, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    paste.setIcon(R.drawable.ic_action_paste);
    paste.setEnabled(activeTerminal);
    paste.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        public boolean onMenuItemClick(MenuItem item) {
            pasteIntoTerminal();
            return true;
        }
    });

    portForward = menu.add(R.string.console_menu_portforwards);
    if (hardKeyboard)
        portForward.setAlphabeticShortcut('f');
    portForward.setIcon(android.R.drawable.ic_menu_manage);
    portForward.setEnabled(sessionOpen && canForwardPorts);
    portForward.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        public boolean onMenuItemClick(MenuItem item) {
            TerminalView terminalView = adapter.getCurrentTerminalView();
            TerminalBridge bridge = terminalView.bridge;

            Intent intent = new Intent(ConsoleActivity.this, PortForwardListActivity.class);
            intent.putExtra(Intent.EXTRA_TITLE, bridge.host.getId());
            ConsoleActivity.this.startActivityForResult(intent, REQUEST_EDIT);
            return true;
        }
    });

    urlscan = menu.add(R.string.console_menu_urlscan);
    if (hardKeyboard)
        urlscan.setAlphabeticShortcut('u');
    urlscan.setIcon(android.R.drawable.ic_menu_search);
    urlscan.setEnabled(activeTerminal);
    urlscan.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        public boolean onMenuItemClick(MenuItem item) {
            final TerminalView terminalView = adapter.getCurrentTerminalView();

            List<String> urls = terminalView.bridge.scanForURLs();

            Dialog urlDialog = new Dialog(ConsoleActivity.this);
            urlDialog.setTitle(R.string.console_menu_urlscan);

            ListView urlListView = new ListView(ConsoleActivity.this);
            URLItemListener urlListener = new URLItemListener(ConsoleActivity.this);
            urlListView.setOnItemClickListener(urlListener);

            urlListView.setAdapter(
                    new ArrayAdapter<String>(ConsoleActivity.this, android.R.layout.simple_list_item_1, urls));
            urlDialog.setContentView(urlListView);
            urlDialog.show();

            return true;
        }
    });

    resize = menu.add(R.string.console_menu_resize);
    if (hardKeyboard)
        resize.setAlphabeticShortcut('s');
    resize.setIcon(android.R.drawable.ic_menu_crop);
    resize.setEnabled(sessionOpen);
    resize.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        public boolean onMenuItemClick(MenuItem item) {
            final TerminalView terminalView = adapter.getCurrentTerminalView();

            @SuppressLint("InflateParams") // Dialogs do not have a parent view.
            final View resizeView = inflater.inflate(R.layout.dia_resize, null, false);
            new android.support.v7.app.AlertDialog.Builder(ConsoleActivity.this, R.style.AlertDialogTheme)
                    .setView(resizeView)
                    .setPositiveButton(R.string.button_resize, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            int width, height;
                            try {
                                width = Integer.parseInt(
                                        ((EditText) resizeView.findViewById(R.id.width)).getText().toString());
                                height = Integer.parseInt(
                                        ((EditText) resizeView.findViewById(R.id.height)).getText().toString());
                            } catch (NumberFormatException nfe) {
                                // TODO change this to a real dialog where we can
                                // make the input boxes turn red to indicate an error.
                                return;
                            }

                            terminalView.forceSize(width, height);
                        }
                    }).setNegativeButton(android.R.string.cancel, null).create().show();

            return true;
        }
    });

    return true;
}

From source file:com.msopentech.applicationgateway.EnterpriseBrowserActivity.java

/**
 * Shows dialog enabling user to bookmark current (by default) or any other page.
 * //from ww w.  j  ava 2 s.  co  m
 * @param v View this method is attached to.
 */
public void showAddBookmarkDialog(View v) {
    try {
        final Dialog dialog = new Dialog(this);
        dialog.setContentView(R.layout.create_bookmark_dialog);
        dialog.setTitle(getString(R.string.bookmark_dialog_title));
        dialog.setCanceledOnTouchOutside(false);

        TextView cancelButton = (TextView) dialog.findViewById(R.id.create_bookmark_cancel);
        TextView saveButton = (TextView) dialog.findViewById(R.id.create_bookmark_ok);

        OnClickListener listener = new OnClickListener() {
            public void onClick(View v) {
                switch (v.getId()) {
                case R.id.create_bookmark_cancel: {
                    dialog.dismiss();
                    break;
                }
                case R.id.create_bookmark_ok: {
                    String name = ((EditText) dialog.findViewById(R.id.create_bookmark_name)).getText()
                            .toString();
                    String address = ((EditText) dialog.findViewById(R.id.create_bookmark_url)).getText()
                            .toString();

                    if (null != name && !(name.contentEquals("")) && null != address
                            && !(address.contentEquals(""))) {
                        PersistenceManager.addRecord(PersistenceManager.ContentType.BOOKMARKS,
                                new URLInfo(address, name));
                    }

                    dialog.dismiss();
                    break;
                }
                }
            }
        };

        cancelButton.setOnClickListener(listener);
        saveButton.setOnClickListener(listener);

        EditText name = (EditText) dialog.findViewById(R.id.create_bookmark_name);
        EditText address = (EditText) dialog.findViewById(R.id.create_bookmark_url);

        name.setText(mActiveWebView.getTitle());
        address.setText(mUrlEditTextView.getText());

        dialog.show();
    } catch (final Exception e) {
        Utility.showAlertDialog(EnterpriseBrowserActivity.class.getSimpleName()
                + ".showAddBookmarkDialog(): Failed. " + e.toString(), EnterpriseBrowserActivity.this);
    }
}

From source file:com.speed.traquer.app.TraqComplaintTaxi.java

private void PromptCustomDialog() {

    // Create custom dialog object
    final Dialog dialog = new Dialog(TraqComplaintTaxi.this);
    // Include dialog.xml file
    dialog.setContentView(R.layout.activity_submit_social);
    // Set dialog title
    dialog.setTitle("Submit via");

    // set values for custom dialog components - text, image and button
    final TextView twitterText = (TextView) dialog.findViewById(R.id.textTwitterDialog);
    twitterText.setText("Twitter");

    final TextView facebookText = (TextView) dialog.findViewById(R.id.textFacebookDialog);
    facebookText.setText("Facebook");

    final TextView defaultText = (TextView) dialog.findViewById(R.id.textDefaultDialog);
    defaultText.setText("Default");
    defaultText.setTextColor(getResources().getColor(R.color.Orange));

    final TextView smsText = (TextView) dialog.findViewById(R.id.textSMSDialog);
    smsText.setText("SMS");

    final ImageView image = (ImageView) dialog.findViewById(R.id.imageDialog);
    image.setImageResource(R.drawable.icon_twitter);

    final ImageView imageFb = (ImageView) dialog.findViewById(R.id.imageDialogFb);
    imageFb.setImageResource(R.drawable.ic_fb_grey);

    final ImageView imageDefault = (ImageView) dialog.findViewById(R.id.imageDialogDefault);
    imageDefault.setImageResource(R.drawable.icon_traquer_color);
    isDefaultSelected = true;//ww  w  .j a  v  a  2 s . c o m

    final ImageView imageSMS = (ImageView) dialog.findViewById(R.id.imageDialogSMS);
    imageSMS.setImageResource(R.drawable.icon_sms);

    dialog.show();

    //Retrieve form info
    taxi_id = inputTaxi.getText().toString().toUpperCase();
    taxi_id = taxi_id.replace(" ", "");
    taxi_comp = actv_comp_taxi.getText().toString();
    taxi_driver = taxiDriver.getText().toString();
    taxi_license = taxiLic.getText().toString();
    loc_frm = actv_from.getText().toString();
    loc_to = actv_to.getText().toString();
    dateBus = editDate.getText().toString();
    timeBus = editTime.getText().toString();
    curr_time = editCurrTime.getText().toString();
    user_name = SaveSharedPreference.getUserName(TraqComplaintTaxi.this);

    //Twitter Button
    final RelativeLayout twitterLogin = (RelativeLayout) dialog.findViewById(R.id.twitterImageButton);
    twitterLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (isTwitterSelected) {
                image.setImageResource(R.drawable.icon_twitter);
                twitterText.setTextColor(getResources().getColor(R.color.DarkGray));
                isTwitterSelected = false;
            } else {
                loginToTwitter();
                image.setImageResource(R.drawable.icon_twitter_blue);
                twitterText.setTextColor(getResources().getColor(R.color.TwitterBlue));
                isTwitterSelected = true;
            }

        }
    });

    //facebook Button
    final RelativeLayout facebookLogin = (RelativeLayout) dialog.findViewById(R.id.facebookImageButton);
    facebookLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (isFacebookSelected) {
                imageFb.setImageResource(R.drawable.ic_fb_grey);
                if (fbUserName != null)
                    facebookText.setText("Facebook");

                facebookText.setTextColor(getResources().getColor(R.color.DarkGray));
                isFacebookSelected = false;
            } else {

                //loginToTwitter();
                // start Facebook Login
                loginToFacebook();
                if (fbUserName != null)
                    facebookText.setText(fbUserName);
                imageFb.setImageResource(R.drawable.ic_fb_blue);
                facebookText.setTextColor(getResources().getColor(R.color.TwitterBlue));
                isFacebookSelected = true;
            }

        }
    });

    //SMS Button
    final RelativeLayout SMSLogin = (RelativeLayout) dialog.findViewById(R.id.smsImageButton);
    SMSLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (isSmsSelected) {
                imageSMS.setImageResource(R.drawable.icon_sms);
                smsText.setTextColor(getResources().getColor(R.color.DarkGray));
                isSmsSelected = false;
            } else {
                imageSMS.setImageResource(R.drawable.icon_sms_color);
                smsText.setTextColor(getResources().getColor(R.color.Orange));
                isSmsSelected = true;
            }

        }
    });

    /*/Default Button
    final RelativeLayout defaultLogin = (RelativeLayout)dialog.findViewById(R.id.defaultImageButton);
    defaultLogin.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        if(isDefaultSelected)
        {
            imageDefault.setImageResource(R.drawable.icon_traquer_color);
            defaultText.setTextColor(getResources().getColor(R.color.Orange));
            isDefaultSelected = false;
        }
        else
        {
            imageDefault.setImageResource(R.drawable.icon_traquer_color);
            defaultText.setTextColor(getResources().getColor(R.color.Orange));
            isDefaultSelected = true;
        }
            
    }
    });*/

    //Submit Button
    Button declineButton = (Button) dialog.findViewById(R.id.submitButton);
    // if decline button is clicked, close the custom dialog
    declineButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //submit complaint
            isSubmitButtonClicked = true;
            if (isNetworkConnected() == true) {
                Toast.makeText(TraqComplaintTaxi.this, "Complaint sent. Thank you for taking action!",
                        Toast.LENGTH_SHORT).show();

                //Combine Strings for Twitter Status

                String status = taxi_id + ", " + taxi_comp + " taxi is speeding with " + speedTaxiExceed
                        + "km/h at " + Double.toString(gLatitude) + "N, " + Double.toString(gLongitude)
                        + "E, " + curr_time + " @aduanSPAD @MyTraquer #Traquer";

                finalStatus = status;

                if (isFacebookSelected) {
                    //share to facebook
                    ShareToFacebook(status);
                    //publishFeedDialog();
                }

                if (isTwitterSelected) {

                    //Toast.makeText(TraqComplaintTaxi.this, Long.toString(twitterID) + userName, Toast.LENGTH_SHORT).show();

                    // Check for blank text
                    if (status.trim().length() > 0) {
                        // update status
                        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1) {
                            new updateTwitterStatus().execute(status);
                        }

                        else
                            new updateTwitterStatus().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, status);

                    } else {
                        // EditText is empty
                        Toast.makeText(getApplicationContext(), "Please enter status message",
                                Toast.LENGTH_SHORT).show();
                    }

                } else {
                    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1)
                        new InsertForm().execute();
                    else
                        new InsertForm().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

                }

                // Close dialog
                dialog.dismiss();

            } else {
                if (isSmsSelected) {
                    Log.i("Clicks", "You clicked sent.");

                    Intent sendIntent = new Intent(Intent.ACTION_VIEW);
                    sendIntent.putExtra("address", "15888");
                    sendIntent.putExtra("sms_body",
                            "SPAD Aduan " + taxi_id + ", " + taxi_comp + " taxi is speeding with "
                                    + speedTaxiExceed + "km/h at " + Double.toString(gLatitude) + "N, "
                                    + Double.toString(gLongitude) + "E, " + curr_time + " - Traquer");
                    sendIntent.setType("vnd.android-dir/mms-sms");
                    startActivity(sendIntent);

                    //1800-88-7723
                } else {
                    Toast.makeText(TraqComplaintTaxi.this,
                            "Failed to send. Please check your network connection.", Toast.LENGTH_SHORT).show();
                }
            }

        }

    });
    //TraqComplaintTaxi.this.showDialog(ALERT_DIALOG);
}