Example usage for android.app AlertDialog.Builder setTitle

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

Introduction

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

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:com.chaosinmotion.securechat.fragments.OnboardingLoginAccount.java

@Override
public void doNext() {
    String uname = username.getText().toString();
    String pwd = password.getText().toString();
    final SCNetworkCredentials creds = new SCNetworkCredentials(uname);
    creds.setPasswordFromClearText(pwd);

    SCNetwork.get().doLogin(creds, new SCNetwork.LoginCallback() {
        @Override// ww  w.  j  a  va  2 s. c  o  m
        public void loginResult(int reason) {
            if (reason == SCNetwork.LOGIN_SUCCESS) {
                /*
                 *  Login success. Register device
                 */

                SCRSAManager.shared().setCredentials(creds.getUsername(), creds.getPassword());
                SCRSAManager.shared().encodeSecureData(getActivity());

                try {
                    /*
                     *  Register device
                     */
                    JSONObject d = new JSONObject();
                    d.put("deviceid", SCRSAManager.shared().getDeviceUUID());
                    d.put("pubkey", SCRSAManager.shared().getPublicKey());

                    SCNetwork.get().request("device/adddevice", d, this, new SCNetwork.ResponseInterface() {
                        @Override
                        public void responseResult(SCNetwork.Response response) {
                            if (response.isSuccess()) {
                                SCMessageQueue.get().startQueue(getActivity());
                                wizardInterface.transitionToFragment(new OnboardingFinished());
                            }
                        }
                    });
                } catch (JSONException ex) {
                }
            } else if (reason == SCNetwork.LOGIN_FAILURE) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                builder.setMessage(R.string.login_error_message);
                builder.setTitle(R.string.login_error_title);
                builder.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // Ignore
                    }
                });
                builder.show();
            }
        }
    });
}

From source file:it.sasabz.android.sasabus.InfoActivity.java

/**
 * Called when the activity is about to start interacting with the user.
 *//*  w  ww  .  j  a va  2s.c  o  m*/
@Override
protected void onResume() {
    super.onResume();
    if (haveNetworkConnection())
        fillData();
    else {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setCancelable(true);
        builder.setMessage(R.string.no_network_connection);
        builder.setTitle(R.string.error_title);
        builder.setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

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

From source file:com.lepin.activity.MyCarVeficActivity.java

/**
 * ?// w w  w. java  2  s . co m
 */
protected void choiceCareType() {
    AlertDialog.Builder builder = new AlertDialog.Builder(MyCarVeficActivity.this);
    builder.setTitle(R.string.my_car_vefic_chtype).setItems(carTypes, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            vfType.setText(carTypes[which]);
        }
    });
    builder.create().show();
}

From source file:com.javierc.albuquerquenow.TransitMap.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    if (item.getItemId() == R.id.offline_routes) {

        if (item.isChecked()) {
            item.setChecked(false);//from   w  ww. j av a2s .  c o  m
            useOfflineRoutes = false;
        } else {
            item.setChecked(true);
            useOfflineRoutes = true;
        }

    } else if (item.getItemId() == R.id.action_legalnotices) {
        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(TransitMap.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();

    } else if (item.getItemId() == R.id.bus_refresh) {
        //first delete all the current markers
        refreshMarkers();
        //plot new markers
        plotBus(actionBar.getSelectedNavigationIndex());

    } else if (item.getItemId() == R.id.bus_stops) {
        new PlotStopsTask(this).execute();
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.njlabs.amrita.aid.info.Calender.java

@Override
public void init(Bundle savedInstanceState) {
    setupLayout(R.layout.activity_calender, Color.parseColor("#fe5352"));

    final Calender thisContext = this;

    descriptions = new HashMap<>();
    backgroundColors = new HashMap<>();
    textColors = new HashMap<>();

    SharedPreferences preferences = getSharedPreferences("app_extra", Context.MODE_PRIVATE);
    Boolean AgreeStatus = preferences.getBoolean("calender_agree", false);

    if (!AgreeStatus) {
        AlertDialog.Builder builder = new AlertDialog.Builder(thisContext);
        builder.setTitle("Academic Calender").setIcon(R.drawable.ic_action_info_small).setMessage(
                "Red denotes that it's an Exam day. Blue denotes an event (not a Holiday). Whereas Green denotes a Holiday. I'm not resposibile for the accuracy of the dates")
                .setCancelable(false).setPositiveButton("I Agree", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        SharedPreferences preferences = getSharedPreferences("app_extra", Context.MODE_PRIVATE);
                        SharedPreferences.Editor editor = preferences.edit();
                        editor.putBoolean("calender_agree", true);
                        editor.apply();/*w ww . j  a  v a 2 s.co  m*/
                    }
                });
        AlertDialog alert = builder.create();
        alert.show();
    }

    caldroidFragment = new CaldroidFragment();

    if (savedInstanceState != null) {
        caldroidFragment.restoreStatesFromKey(savedInstanceState, "CALDROID_SAVED_STATE");
    } else {
        Bundle args = new Bundle();
        Calendar cal = Calendar.getInstance();
        args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1);
        args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR));
        args.putBoolean(CaldroidFragment.ENABLE_SWIPE, true);
        caldroidFragment.setArguments(args);
    }

    setCustomResourceForDates();

    FragmentTransaction t = getSupportFragmentManager().beginTransaction();
    t.replace(R.id.calendar, caldroidFragment);
    t.commit();

    final CaldroidListener listener = new CaldroidListener() {
        @Override
        public void onSelectDate(Date date, View view) {
            if (!formatter.format(date).equals("")) {
                String description = descriptions.get(formatter.format(date));
                if (description != null && !description.equals("")) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(thisContext);
                    builder.setMessage(description).setCancelable(true).setPositiveButton("Close",
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {
                                    dialog.cancel();
                                }
                            });
                    AlertDialog alert = builder.create();
                    alert.show();
                }
            }
        }
    };
    caldroidFragment.setCaldroidListener(listener);
}

From source file:com.intel.xdk.notification.Notification.java

public void alert(String message, String title, String button) {
    if (button == null || button.length() == 0 || button.equals("undefined"))
        button = "OK";
    AlertDialog.Builder alertBldr = new AlertDialog.Builder(activity);
    alertBldr.setMessage(message);/*from w w w  .j  a  v  a 2 s. c om*/
    alertBldr.setTitle((title == null || title.length() == 0 || title.equals("undefined")) ? "Alert" : title);
    alertBldr.setPositiveButton(button, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    alertBldr.show();
}

From source file:com.restswitch.controlpanel.MainActivity.java

private void alertError(String msg) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Error");
    builder.setMessage(msg);//from w  w w  . j  a  v  a 2  s  . c  o  m
    builder.setNeutralButton("OK", null);
    builder.setIcon(android.R.drawable.ic_dialog_alert);
    builder.show();
}

From source file:com.restswitch.controlpanel.MainActivity.java

private void alertInfo(String msg) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Information");
    builder.setMessage(msg);// w  ww  .j  a v a2  s.  co m
    builder.setNeutralButton("OK", null);
    builder.setIcon(android.R.drawable.ic_dialog_info);
    builder.show();
}

From source file:com.xargsgrep.portknocker.activity.EditHostActivity.java

private void showCancelDialog() {
    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
    dialogBuilder.setTitle(R.string.confirm_dialog_cancel_edit_title);
    dialogBuilder.setIcon(R.drawable.ic_dialog_confirm);

    dialogBuilder.setPositiveButton(R.string.confirm_dialog_confirm, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            returnToHostListActivity(null);
        }/* w w w  .j  a va 2  s .  c o  m*/
    });
    dialogBuilder.setNegativeButton(R.string.confirm_dialog_cancel, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
        }
    });

    cancelDialog = dialogBuilder.create();
    cancelDialog.show();
}

From source file:es.uniovi.imovil.fcrtrainer.HexadecimalExerciseFragment.java

/**
 * Shows a dialog with the game stats when the game is over
 * //from w w  w.  j  a v  a2 s  .c o m
 * @param remainingTime
 */
public void showEndGameDialog(int remainingTime) {
    AlertDialog.Builder abuilder = new AlertDialog.Builder(getActivity());
    abuilder.setTitle(getString(R.string.game_over));

    if (remainingTime > 0)
        abuilder.setMessage(String.format(getString(R.string.gameisoverexp), remainingTime, pointsCounter));
    else
        abuilder.setMessage(String.format(getString(R.string.lost_time_over), pointsCounter));

    abuilder.create().show();
}