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.facebook.samples.sessionlogin.LoginUsingActivityActivity.java

public void showDialog() {
    final Dialog dialog = new Dialog(LoginUsingActivityActivity.this);
    dialog.setContentView(R.layout.list_view_contact);
    dialog.setTitle("Pic Number");
    ListView listView = (ListView) dialog.findViewById(R.id.lc_contacts);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.spinner_row_view,
            list);//from   w  ww. java2  s. c o  m
    listView.setAdapter(adapter);

    dialog.show();
    /*DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
            
    dialog.getWindow().setLayout(metrics.heightPixels, metrics.widthPixels);*/
}

From source file:com.wrmndfzzy.atomize.intro.IntroActivity.java

protected void applicenseDialog() {
    final Dialog aLDialog = new Dialog(IntroActivity.this);
    aLDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    aLDialog.setTitle("License Agreement");
    aLDialog.setCancelable(false);/*from  w  w w . j a  v  a 2s .  com*/
    aLDialog.setCanceledOnTouchOutside(false);
    aLDialog.setContentView(R.layout.app_license_dialog);
    WebView lic = (WebView) aLDialog.findViewById(R.id.atomizeLic);
    Button disagree = (Button) aLDialog.findViewById(R.id.alDialogDisagree);
    Button agree = (Button) aLDialog.findViewById(R.id.alDialogAgree);
    lic.getSettings().setUseWideViewPort(true);
    lic.loadUrl("file:///android_asset/atomizeLicense.html");
    disagree.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            aLDialog.dismiss();
            SharedPreferences.Editor e = getPrefs.edit();
            e.putBoolean("agreedToLicense", false);
            e.apply();
            Intent homeIntent = new Intent(Intent.ACTION_MAIN);
            homeIntent.addCategory(Intent.CATEGORY_HOME);
            homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(homeIntent);
            IntroActivity.this.finish();
            MainActivity.getInstance().finish();
        }
    });
    agree.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            SharedPreferences.Editor e = getPrefs.edit();
            e.putBoolean("agreedToLicense", true);
            e.apply();
            aLDialog.dismiss();
        }
    });
    aLDialog.show();
}

From source file:com.sonymobile.androidapp.gridcomputing.activities.WizardActivity.java

/**
 * Show read more dialog.//  w  w  w  . jav a 2s .  c  o m
 */
public final void showReadMoreDialog() {
    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.dialog_wizard_info);

    // Fullscreen
    dialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    dialog.setTitle(R.string.more_info);
    final String[] texts = getResources().getStringArray(R.array.help_find_cure);

    ((TextView) dialog.findViewById(R.id.more_info_tv1)).setText(texts[0]);
    ((TextView) dialog.findViewById(R.id.more_info_tv2)).setText(texts[1]);
    ((TextView) dialog.findViewById(R.id.more_info_tv3)).setText(texts[2]);

    dialog.findViewById(R.id.bt_wizard_done).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:com.laquysoft.bycon.GoogleCardsActivity.java

public void postOrder(View w) {
    Log.i("ListActivity", "Post Order");
    new OrderTask().execute();

    // custom dialog
    final Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.payment_dialog);
    dialog.setTitle("Place & Pay Order");

    // set the custom dialog components - text, image and button
    ImageView image = (ImageView) dialog.findViewById(R.id.image);
    image.setImageResource(R.drawable.ic_launcher);

    Button dialogButton = (Button) dialog.findViewById(R.id.btn_accept);
    // if button is clicked, close the custom dialog
    dialogButton.setOnClickListener(new View.OnClickListener() {
        @Override/*  ww w  .j av  a  2  s. c o m*/
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    Button dialogCancelButton = (Button) dialog.findViewById(R.id.btn_reject);
    // if button is clicked, close the custom dialog
    dialogCancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:com.coinblesk.client.backup.BackupDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setTitle(R.string.fragment_backup_title);
    return dialog;
}

From source file:com.osama.cryptofm.startup.OptionActivity.java

private void generateKeys() {
    //show password dialog
    final Dialog dialog = new Dialog(this);
    dialog.setCancelable(false);// w  w  w .  j a  va 2s.  c  o  m
    dialog.setContentView(R.layout.passwords_fragment_layout);
    dialog.setTitle("keys password");
    final TextInputEditText editText = (TextInputEditText) dialog.findViewById(R.id.gen_keys_password_edit);
    final TextInputEditText confirmEditText = (TextInputEditText) dialog
            .findViewById(R.id.gen_keys_password_edit_confirm);
    dialog.show();

    dialog.findViewById(R.id.trigger_gen_key_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //test the passwords
            if (isValidPassword(editText.getText())) {
                if (editText.getText().toString().equals(confirmEditText.getText().toString())) {
                    //be sure to dismiss the dialog
                    dialog.dismiss();
                    //start the async task
                    mKeyPassword = editText.getText().toString();
                    new KeyGenerationTask().execute();
                } else {
                    confirmEditText.setError("Password does not match");
                }
            } else {
                editText.setError("Password should contain at least three characters");
            }

        }
    });
    dialog.findViewById(R.id.cancel_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
}

From source file:io.spw.hello.SectionsPagerAdapter.java

public void showMatchDialog() throws JSONException, ParseException {

    final Dialog dialog = new Dialog(mActivity);
    dialog.setContentView(R.layout.dialog_match_made);
    dialog.setTitle("An introduction is the essence of possibility");

    // find views
    TextView userName0 = (TextView) dialog.findViewById(R.id.userName0);
    TextView userInfo0 = (TextView) dialog.findViewById(R.id.userInfo0);
    TextView userName1 = (TextView) dialog.findViewById(R.id.userName1);
    TextView userInfo1 = (TextView) dialog.findViewById(R.id.userInfo1);
    TextView userName2 = (TextView) dialog.findViewById(R.id.userName2);
    TextView userInfo2 = (TextView) dialog.findViewById(R.id.userInfo2);
    Button helloButton = (Button) dialog.findViewById(R.id.dialog_hello_button);

    // get member users
    JSONArray userIds = currentUser.getJSONArray(ParseConstants.KEY_MEMBER_IDS);
    ParseRelation<ParseUser> groupMembersRelation = currentUser
            .getRelation(ParseConstants.KEY_GROUP_MEMBERS_RELATION);
    List<ParseUser> users = new ArrayList<>();
    for (int i = 0; i < userIds.length(); i++) {
        if (!currentUser.getObjectId().equals(userIds.getString(i))) {
            ParseUser user = ParseUser.getQuery().get(userIds.getString(i));
            users.add(user);//from   www.  j  a  va 2s . c om
            groupMembersRelation.add(user);
        }
    }

    // set text
    userName0.setText(users.get(0).getString(ParseConstants.KEY_FIRST_NAME));
    userInfo0.setText(users.get(0).getString(ParseConstants.KEY_AGE) + " // "
            + (users.get(0).getString(ParseConstants.KEY_HOMETOWN)));

    userName1.setText(users.get(1).getString(ParseConstants.KEY_FIRST_NAME));
    userInfo1.setText(users.get(1).getString(ParseConstants.KEY_AGE) + " // "
            + (users.get(1).getString(ParseConstants.KEY_HOMETOWN)));

    userName2.setText(users.get(2).getString(ParseConstants.KEY_FIRST_NAME));
    userInfo2.setText(users.get(2).getString(ParseConstants.KEY_AGE) + " // "
            + (users.get(2).getString(ParseConstants.KEY_HOMETOWN)));

    // set button
    helloButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            currentUser.put(ParseConstants.KEY_MATCH_DIALOG_SEEN, true);
            currentUser.saveInBackground();
            if (mFirstFragment instanceof ThisWeekendFragment) {
                switchToGroupChatFragment();
            }
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:com.sssemil.advancedsettings.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    new Thread(new Runnable() {
        @Override//ww w. j a v a 2s. co m
        public void run() {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                while (ContextCompat.checkSelfPermission(MainActivity.this,
                        Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(MainActivity.this,
                            new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }, REQUEST);

                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

                while (ContextCompat.checkSelfPermission(MainActivity.this,
                        Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(MainActivity.this,
                            new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, REQUEST);

                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

                while (ContextCompat.checkSelfPermission(MainActivity.this,
                        Manifest.permission.WRITE_SETTINGS) != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(MainActivity.this,
                            new String[] { Manifest.permission.WRITE_SETTINGS }, REQUEST);

                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

                while (ContextCompat.checkSelfPermission(MainActivity.this,
                        Manifest.permission.SYSTEM_ALERT_WINDOW) != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(MainActivity.this,
                            new String[] { Manifest.permission.SYSTEM_ALERT_WINDOW }, REQUEST);

                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

                /*if (!android.provider.Settings.System.canWrite(MainActivity.this)) {
                mContinue = false;
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        mAlertDialog = new AlertDialog.Builder(MainActivity.this)
                                .setMessage(getString(R.string.grant_access_settings))
                                .setPositiveButton(getString(android.R.string.ok),
                                        new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface dialog, int which) {
                                                mContinue = true;
                                            }
                                        })
                                .create();
                        mAlertDialog.show();
                    }
                });
                        
                while (!mContinue) {
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                        
                Intent intent = new Intent();
                intent.setAction(android.provider.Settings.ACTION_MANAGE_WRITE_SETTINGS);
                intent.setData(Uri.parse("package:" + getPackageName()));
                        
                // Start Activity
                startActivityForResult(intent, REQUEST);
                        
                while (!mContinueActivity) {
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                }*/
            }
        }
    }).start();

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    sharedPreferences.edit().putString("system_language", Locale.getDefault().getLanguage().toLowerCase() + "-"
            + Locale.getDefault().getCountry().toUpperCase()).apply();

    sharedPreferences.registerOnSharedPreferenceChangeListener(this);

    final View prefsRoot = inflater.inflate(R.layout.preferences, null);

    final List<Preference> loadedPreferences = new ArrayList<>();
    for (int i = 0; i < ((PreferenceScreen) prefsRoot).getChildCount(); i++) {
        if ((parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)).getKey()).equals("wifi_settings")) {
            if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI)) {
                loadedPreferences.add(parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)));
            }
        } else if ((parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)).getKey())
                .equals("bluetooth_setting")) {
            if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
                loadedPreferences.add(parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)));
            }
        } else if ((parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)).getKey())
                .equals("power_settings")) {
            loadedPreferences.add(parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)));
        } else if ((parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)).getKey())
                .equals("system_language")) {
            if (Utils.isPackageInstalled("sssemil.com.languagesettingsprovider", this, 1)) {
                loadedPreferences.add(parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)));
            }
        } else {
            loadedPreferences.add(parsePreference(((PreferenceScreen) prefsRoot).getChildAt(i)));
        }
    }
    addPreferences(loadedPreferences);

    this.startService(new Intent(this, MainService.class));

    if (!Utils.isDeviceRooted()) {
        Dialog dialog = new Dialog(this);
        dialog.setTitle("Warning");
        dialog.setContentView(R.layout.warning);
        dialog.show();
    }
}

From source file:com.flowzr.activity.DateFilterActivity.java

@Override
protected Dialog onCreateDialog(final int id) {
    final Dialog d = new Dialog(this);
    d.setCancelable(true);/*  ww  w  .  j a v  a2 s.c  o m*/
    d.setTitle(id == 1 ? R.string.period_from : R.string.period_to);
    d.setContentView(R.layout.filter_period_select);
    Button bOk = (Button) d.findViewById(R.id.bOK);
    bOk.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setDialogResult(d, id == 1 ? cFrom : cTo);
            d.dismiss();
        }
    });
    Button bCancel = (Button) d.findViewById(R.id.bCancel);
    bCancel.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            d.cancel();
        }
    });
    return d;
}

From source file:de.vanita5.twittnuker.fragment.support.FileSelectorDialogFragment.java

private void setTitle(final CharSequence title) {
    final Dialog dialog = getDialog();
    if (dialog == null)
        return;/*ww  w. j  a v  a  2s.  c o  m*/
    dialog.setTitle(title);
}