Example usage for android.app Dialog setContentView

List of usage examples for android.app Dialog setContentView

Introduction

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

Prototype

public void setContentView(@NonNull View view) 

Source Link

Document

Set the screen content to an explicit view.

Usage

From source file:de.bogutzky.psychophysiocollector.app.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_add_bluetooth_device) {
        addBluetoothDevice();//from   w ww .java  2  s.c  o m
        return true;
    }

    if (id == R.id.action_connect) {
        disconnectMenuItem.setEnabled(true);
        connectMenuItem.setEnabled(false);
        addMenuItem.setEnabled(false);
        connectAllShimmerImus();
        connectBioHarness();
    }

    if (id == R.id.action_disconnect) {
        disconnectDevices();
    }

    if (id == R.id.action_settings) {
        showSettings();
    }

    if (id == R.id.action_start_streaming) {
        this.isFirstSelfReportRequest = true;
        startSession();
        //showQuestionnaire(true);
    }

    if (id == R.id.action_stop_streaming) {
        this.isSessionStarted = false;
        this.stopTimestamp = System.currentTimeMillis();
        stopAllStreamingOfAllShimmerImus();
        stopStreamingBioHarness();
        stopStreamingInternalSensorData();

        if (intervalConfigured) {
            stopTimerThread();
        } else {
            feedbackNotification();
            showQuestionnaire();
        }

        this.directoryName = null;
        this.startStreamMenuItem.setEnabled(true);
        this.stopStreamMenuItem.setEnabled(false);
        this.disconnectMenuItem.setEnabled(true);
    }

    if (id == R.id.action_info) {
        Dialog dialog = new Dialog(this);
        dialog.setTitle(getString(R.string.action_info));
        dialog.setContentView(R.layout.info_popup);

        TextView infoSessionStatus = (TextView) dialog.findViewById(R.id.textViewInfoSessionStatus);
        if (isSessionStarted) {
            infoSessionStatus.setText(getString(R.string.info_started));
        }

        if (shimmerImuService != null) {
            int shimmerImuCount = shimmerImuService.shimmerImuMap.values().size();

            TextView infoShimmerImoConnectionStatus = (TextView) dialog
                    .findViewById(R.id.textViewInfoShimmerImoConnectionStatus);
            infoShimmerImoConnectionStatus.setText(getString(R.string.info_number_connected, shimmerImuCount));
        }

        if (bioHarnessService != null) {
            if (bioHarnessService.isBioHarnessConnected()) {
                TextView infoBioHarnessConnectionStatus = (TextView) dialog
                        .findViewById(R.id.textViewInfoBioHarnessConnectionStatus);
                infoBioHarnessConnectionStatus.setText(getString(R.string.info_number_connected, 1));
            }
        }

        infoGpsConnectionStatus = (TextView) dialog.findViewById(R.id.textViewInfoGpsConnectionStatus);
        if (gpsStatusText == null) {
            gpsStatusText = getString(R.string.info_not_connected);
        }
        infoGpsConnectionStatus.setText(gpsStatusText);

        TextView infoVersionName = (TextView) dialog.findViewById(R.id.textViewInfoVersionName);
        try {
            PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
            infoVersionName.setText(packageInfo.versionName);
        } catch (PackageManager.NameNotFoundException e) {
            Log.e(TAG, "Could not read package info", e);
            infoVersionName.setText(R.string.info_could_not_read);
        }
        dialog.show();
    }
    return super.onOptionsItemSelected(item);
}

From source file:edu.berkeley.boinc.PrefsActivity.java

public void onItemClick(View view) {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Object item = view.getTag();/* ww w . ja v a  2 s  .  c  o m*/

    if (item instanceof PrefsListItemWrapperValue) {
        final PrefsListItemWrapperValue valueWrapper = (PrefsListItemWrapperValue) item;
        if (Logging.DEBUG)
            Log.d(Logging.TAG, "PrefsActivity onItemClick Value " + valueWrapper.ID);

        if (valueWrapper.isPct) {
            // show dialog with slider
            dialog.setContentView(R.layout.prefs_layout_dialog_pct);
            // setup slider
            TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
            sliderProgress.setText(valueWrapper.status.intValue() + " " + getString(R.string.prefs_unit_pct));
            Double seekBarDefault = valueWrapper.status / 10;
            SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);
            slider.setProgress(seekBarDefault.intValue());
            slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                    String progressString = (progress * 10) + " " + getString(R.string.prefs_unit_pct);
                    TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                    sliderProgress.setText(progressString);
                }

                @Override
                public void onStartTrackingTouch(SeekBar seekBar) {
                }

                @Override
                public void onStopTrackingTouch(SeekBar seekBar) {
                }
            });
        } else if (valueWrapper.isNumber) {
            if (!getHostInfo()) {
                if (Logging.WARNING)
                    Log.w(Logging.TAG, "onItemClick missing hostInfo");
                return;
            }

            // show dialog with slider
            dialog.setContentView(R.layout.prefs_layout_dialog_pct);
            TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
            sliderProgress.setText("" + valueWrapper.status.intValue());
            SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);

            // slider setup depending on actual preference
            if (valueWrapper.ID == R.string.prefs_cpu_number_cpus_header) {
                slider.setMax(hostinfo.p_ncpus);
                slider.setProgress(valueWrapper.status.intValue());
                slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                        if (progress == 0)
                            progress = 1; // do not allow 0 cpus
                        String progressString = String.valueOf(progress);
                        TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                        sliderProgress.setText(progressString);
                    }

                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {
                    }

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {
                    }
                });
            } else if (valueWrapper.ID == R.string.prefs_gui_log_level_header) {
                slider.setMax(5);
                slider.setProgress(valueWrapper.status.intValue());
                slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                        String progressString = String.valueOf(progress);
                        TextView sliderProgress = (TextView) dialog.findViewById(R.id.seekbar_status);
                        sliderProgress.setText(progressString);
                    }

                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {
                    }

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {
                    }
                });
            }
        } else {
            // show dialog with edit text
            dialog.setContentView(R.layout.prefs_layout_dialog);
        }
        // show preference name
        ((TextView) dialog.findViewById(R.id.pref)).setText(valueWrapper.ID);

        // setup buttons
        Button confirm = (Button) dialog.findViewById(R.id.confirm);
        confirm.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                double value = 0.0;
                Boolean clientPref = true;
                if (valueWrapper.isPct) {
                    SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);
                    value = slider.getProgress() * 10;
                } else if (valueWrapper.isNumber) {
                    SeekBar slider = (SeekBar) dialog.findViewById(R.id.seekbar);
                    int sbProgress = slider.getProgress();
                    if (valueWrapper.ID == R.string.prefs_cpu_number_cpus_header) {
                        if (sbProgress == 0)
                            sbProgress = 1;
                        value = numberCpuCoresToPct(sbProgress);
                    } else if (valueWrapper.ID == R.string.prefs_gui_log_level_header) {
                        appPrefs.setLogLevel(sbProgress);
                        updateValuePref(valueWrapper.ID, (double) sbProgress);
                        clientPref = false; // avoid writing client prefs via rpc
                        updateLayout();
                    }
                } else {
                    EditText edit = (EditText) dialog.findViewById(R.id.Input);
                    String input = edit.getText().toString();
                    Double valueTmp = parseInputValueToDouble(input);
                    if (valueTmp == null)
                        return;
                    value = valueTmp;
                }
                if (clientPref)
                    writeClientValuePreference(valueWrapper.ID, value);
                dialog.dismiss();
            }
        });
        Button cancel = (Button) dialog.findViewById(R.id.cancel);
        cancel.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();

    } else {
        // instance of PrefsListItemWrapper, i.e. client log flags
        PrefsListItemWrapper wrapper = (PrefsListItemWrapper) item;
        if (Logging.DEBUG)
            Log.d(Logging.TAG, "PrefsActivity onItemClick super " + wrapper.ID);

        dialog.setContentView(R.layout.prefs_layout_dialog_selection);
        final ArrayList<ClientLogOption> options = new ArrayList<ClientLogOption>();
        String[] array = getResources().getStringArray(R.array.prefs_client_log_flags);
        for (String option : array)
            options.add(new ClientLogOption(option));
        ListView lv = (ListView) dialog.findViewById(R.id.selection);
        new PrefsLogOptionsListAdapter(this, lv, R.id.selection, options);

        // setup buttons
        Button confirm = (Button) dialog.findViewById(R.id.confirm);
        confirm.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ArrayList<String> selectedOptions = new ArrayList<String>();
                for (ClientLogOption option : options)
                    if (option.selected)
                        selectedOptions.add(option.name);
                if (Logging.DEBUG)
                    Log.d(Logging.TAG, selectedOptions.size() + " log flags selected");
                new SetCcConfigAsync().execute(formatOptionsToCcConfig(selectedOptions));
                dialog.dismiss();
            }
        });
        Button cancel = (Button) dialog.findViewById(R.id.cancel);
        cancel.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();
    }
}

From source file:app.clirnet.com.clirnetapp.activity.LoginActivity.java

private void showCreatePatientAlertDialog() {

    final Dialog dialog = new Dialog(this);

    dialog.setContentView(R.layout.no_inetrnet_login_dialog);

    dialog.setTitle(//w  w  w .j  a va2s  . com
            "Your security credentials have expired. Please login with an active internet connection to refresh.");
    //  dialog.setCancelable(false);

    Button dialogButtonCancel = (Button) dialog.findViewById(R.id.customDialogCancel);
    Button dialogButtonOk = (Button) dialog.findViewById(R.id.customDialogOk);
    // Click cancel to dismiss android custom dialog box
    dialogButtonCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            dialog.dismiss();

        }
    });

    // Your android custom dialog ok action
    // Action for custom dialog ok button click
    dialogButtonOk.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);

            dialog.dismiss();

        }
    });

    dialog.show();

}

From source file:org.tigase.mobile.TigaseMobileMessengerActivity.java

@Override
protected Dialog onCreateDialog(int id, Bundle bundle) {
    switch (id) {
    case NEWS_DIALOG: {

        String str = bundle.getString("news_html");

        Builder bldr = new AlertDialog.Builder(this);
        bldr.setTitle("News");
        bldr.setCancelable(true);/*from   ww  w .ja v  a2 s  .  c om*/
        bldr.setMessage(Html.fromHtml(str));
        return bldr.create();
    }

    case CONTACT_REMOVE_DIALOG:
        return null;
    case ABOUT_DIALOG: {

        final Dialog dialog = new Dialog(this);
        dialog.setCancelable(true);
        dialog.setCanceledOnTouchOutside(true);

        dialog.setContentView(R.layout.about_dialog);
        dialog.setTitle(getString(R.string.aboutButton));

        TextView tos = (TextView) dialog.findViewById(R.id.aboutTermsOfService);
        tos.setText(Html.fromHtml("<a href='" + getResources().getString(R.string.termsOfServiceURL) + "'>"
                + getResources().getString(R.string.termsOfService) + "</a>"));
        tos.setMovementMethod(LinkMovementMethod.getInstance());

        TextView pp = (TextView) dialog.findViewById(R.id.aboutPrivacyPolicy);
        pp.setText(Html.fromHtml("<a href='" + getResources().getString(R.string.privacyPolicyURL) + "'>"
                + getResources().getString(R.string.privacyPolicy) + "</a>"));
        pp.setMovementMethod(LinkMovementMethod.getInstance());

        Button okButton = (Button) dialog.findViewById(R.id.okButton);
        okButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                dialog.cancel();
            }
        });
        return dialog;
    }
    default:
        return null;
    }
}

From source file:com.klinker.android.twitter.activities.profile_viewer.ProfilePager.java

public void updateProfile() {
    final Dialog dialog = new Dialog(context);
    dialog.setContentView(R.layout.change_profile_info_dialog);
    dialog.setTitle(getResources().getString(R.string.change_profile_info) + ":");

    final HoloEditText name = (HoloEditText) dialog.findViewById(R.id.name);
    final HoloEditText url = (HoloEditText) dialog.findViewById(R.id.url);
    final HoloEditText location = (HoloEditText) dialog.findViewById(R.id.location);
    final HoloEditText description = (HoloEditText) dialog.findViewById(R.id.description);

    name.setText(thisUser.getName());//  w w  w.j  av a2s . co  m

    try {
        url.setText(thisUser.getURLEntity().getDisplayURL());
    } catch (Exception e) {

    }

    location.setText(thisUser.getLocation());
    description.setText(thisUser.getDescription());

    Button cancel = (Button) dialog.findViewById(R.id.cancel);
    cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    Button change = (Button) dialog.findViewById(R.id.change);
    change.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            boolean ok = true;
            String nameS = null;
            String urlS = null;
            String locationS = null;
            String descriptionS = null;

            if (name.getText().length() <= 20 && ok) {
                if (name.getText().length() > 0) {
                    nameS = name.getText().toString();
                    sharedPrefs.edit()
                            .putString("twitter_users_name_" + sharedPrefs.getInt("current_account", 1), nameS)
                            .commit();
                }
            } else {
                ok = false;
                Toast.makeText(context, getResources().getString(R.string.name_char_length), Toast.LENGTH_SHORT)
                        .show();
            }

            if (url.getText().length() <= 100 && ok) {
                if (url.getText().length() > 0) {
                    urlS = url.getText().toString();
                }
            } else {
                ok = false;
                Toast.makeText(context, getResources().getString(R.string.url_char_length), Toast.LENGTH_SHORT)
                        .show();
            }

            if (location.getText().length() <= 30 && ok) {
                if (location.getText().length() > 0) {
                    locationS = location.getText().toString();
                }
            } else {
                ok = false;
                Toast.makeText(context, getResources().getString(R.string.location_char_length),
                        Toast.LENGTH_SHORT).show();
            }

            if (description.getText().length() <= 160 && ok) {
                if (description.getText().length() > 0) {
                    descriptionS = description.getText().toString();
                }
            } else {
                ok = false;
                Toast.makeText(context, getResources().getString(R.string.description_char_length),
                        Toast.LENGTH_SHORT).show();
            }

            if (ok) {
                new UpdateInfo(nameS, urlS, locationS, descriptionS).execute();
                dialog.dismiss();
            }
        }
    });

    dialog.show();
}

From source file:com.klinker.android.twitter.ui.profile_viewer.ProfilePager.java

public void updateProfile() {
    final Dialog dialog = new Dialog(context);
    dialog.setContentView(R.layout.change_profile_info_dialog);
    dialog.setTitle(getResources().getString(R.string.change_profile_info) + ":");

    final HoloEditText name = (HoloEditText) dialog.findViewById(R.id.name);
    final HoloEditText url = (HoloEditText) dialog.findViewById(R.id.url);
    final HoloEditText location = (HoloEditText) dialog.findViewById(R.id.location);
    final HoloEditText description = (HoloEditText) dialog.findViewById(R.id.description);

    Button cancel = (Button) dialog.findViewById(R.id.cancel);
    cancel.setOnClickListener(new View.OnClickListener() {
        @Override//from w w w .ja va2  s.co  m
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    Button change = (Button) dialog.findViewById(R.id.change);
    change.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            boolean ok = true;
            String nameS = null;
            String urlS = null;
            String locationS = null;
            String descriptionS = null;

            if (name.getText().length() <= 20 && ok) {
                if (name.getText().length() > 0) {
                    nameS = name.getText().toString();
                    sharedPrefs.edit()
                            .putString("twitter_users_name_" + sharedPrefs.getInt("current_account", 1), nameS)
                            .commit();
                }
            } else {
                ok = false;
                Toast.makeText(context, getResources().getString(R.string.name_char_length), Toast.LENGTH_SHORT)
                        .show();
            }

            if (url.getText().length() <= 100 && ok) {
                if (url.getText().length() > 0) {
                    urlS = url.getText().toString();
                }
            } else {
                ok = false;
                Toast.makeText(context, getResources().getString(R.string.url_char_length), Toast.LENGTH_SHORT)
                        .show();
            }

            if (location.getText().length() <= 30 && ok) {
                if (location.getText().length() > 0) {
                    locationS = location.getText().toString();
                }
            } else {
                ok = false;
                Toast.makeText(context, getResources().getString(R.string.location_char_length),
                        Toast.LENGTH_SHORT).show();
            }

            if (description.getText().length() <= 160 && ok) {
                if (description.getText().length() > 0) {
                    descriptionS = description.getText().toString();
                }
            } else {
                ok = false;
                Toast.makeText(context, getResources().getString(R.string.description_char_length),
                        Toast.LENGTH_SHORT).show();
            }

            if (ok) {
                new UpdateInfo(nameS, urlS, locationS, descriptionS).execute();
                dialog.dismiss();
            }
        }
    });

    dialog.show();
}

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/*w  ww . j  av  a2 s. co m*/
            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:org.wso2.iot.agent.activities.AuthenticationActivity.java

/**
 * Show the license text retrieved from the server.
 *
 * @param licenseText Message text to be shown as the license.
 * @param title   Title of the license./* w w  w .ja va  2  s. c  om*/
 */
private void showAgreement(final String licenseText, final String title) {
    AuthenticationActivity.this.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            final Dialog dialog = new Dialog(context, R.style.Dialog);
            dialog.setContentView(R.layout.dialog_license);
            dialog.setCancelable(false);

            WebView webView = (WebView) dialog.findViewById(R.id.webViewLicense);
            webView.loadDataWithBaseURL(null, licenseText, Constants.MIME_TYPE, Constants.ENCODING_METHOD,
                    null);

            TextView textViewTitle = (TextView) dialog.findViewById(R.id.textViewDeviceNameTitle);
            textViewTitle.setText(title);

            Button btnAgree = (Button) dialog.findViewById(R.id.dialogButtonOK);
            Button btnCancel = (Button) dialog.findViewById(R.id.dialogButtonCancel);

            btnAgree.setOnClickListener(new OnClickListener() {
                @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
                @Override
                public void onClick(View v) {
                    Preference.putBoolean(context, Constants.PreferenceFlag.IS_AGREED, true);
                    dialog.dismiss();
                    //load the next intent based on ownership type
                    startDeviceAdminPrompt();
                }
            });

            btnCancel.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                    CommonUtils.clearClientCredentials(context);
                    cancelEntry();
                }
            });

            dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                    if (keyCode == KeyEvent.KEYCODE_SEARCH
                            && event.getRepeatCount() == Constants.DEFAULT_REPEAT_COUNT) {
                        return true;
                    } else if (keyCode == KeyEvent.KEYCODE_BACK
                            && event.getRepeatCount() == Constants.DEFAULT_REPEAT_COUNT) {
                        return true;
                    }
                    return false;
                }
            });

            dialog.show();
        }
    });
}

From source file:com.thingsee.tracker.MainActivity.java

@Override
public void onBackPressed() {
    if (touchActive) {
        if (onChildOnMapView) {
            if ((trackerModelWithMarker != null) && (trackerModelWithMarker.getMarker().isInfoWindowShown())) {
                trackerModelWithMarker.getMarker().hideInfoWindow();
            }/*w  w w  . jav a  2 s .  c  o  m*/
            displayTrackers();
            trackerList.setVisibility(View.VISIBLE);
            onChildOnMapView = false;
            userZoomAndPanOnMap = false;
            zoomToBoundingBox();
        } else {
            final Dialog exitQuery = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
            exitQuery.requestWindowFeature(Window.FEATURE_NO_TITLE);
            exitQuery.setCancelable(true);
            exitQuery.setContentView(R.layout.exit_app_query);
            ClearTextView cancel = (ClearTextView) exitQuery.findViewById(R.id.cancel);
            cancel.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    exitQuery.cancel();
                }
            });
            ClearTextView exit = (ClearTextView) exitQuery.findViewById(R.id.exit);
            exit.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    exitApplication();
                    startupDone = false;
                    exitQuery.cancel();
                }
            });
            exitQuery.show();
            exitQuery.getWindow().setDimAmount(0.5f);
            exitQuery.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        }
    }
}

From source file:com.liangxun.yuejiula.huanxin.chat.activity.GroupsActivity.java

private void showMsgFenghao() {
    final Dialog picAddDialog = new Dialog(GroupsActivity.this, R.style.dialog);
    View picAddInflate = View.inflate(this, R.layout.msg_mine_dialog, null);
    TextView jubao_sure = (TextView) picAddInflate.findViewById(R.id.jubao_sure);
    final TextView content = (TextView) picAddInflate.findViewById(R.id.content);
    content.setText("????");
    //??/*from   w w  w  .j a  v  a  2  s  .c  o  m*/
    jubao_sure.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getManagerBySchoolId();
            picAddDialog.dismiss();
        }
    });

    //?
    TextView jubao_cancle = (TextView) picAddInflate.findViewById(R.id.jubao_cancle);
    jubao_cancle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            picAddDialog.dismiss();
        }
    });
    picAddDialog.setContentView(picAddInflate);
    picAddDialog.show();
}