List of usage examples for android.app AlertDialog.Builder show
public void show()
From source file:com.google.zxing.client.android.result.ResultHandler.java
/** * Like {@link #rawLaunchIntent(Intent)} but will show a user dialog if nothing is available to handle. *///from w ww.ja v a 2s. com final void launchIntent(Intent intent) { try { rawLaunchIntent(intent); } catch (ActivityNotFoundException ignored) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.app_name); builder.setMessage(R.string.msg_intent_failed); builder.setPositiveButton(R.string.button_ok, null); builder.show(); } }
From source file:com.zbrown.droidsteal.activities.HijackActivity.java
private void selectURL() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getString(R.string.changeurl)); alert.setMessage(getString(R.string.customurl)); // Set an EditText view to get user input final EditText inputName = new EditText(this); inputName.setText(HijackActivity.this.webview.getUrl()); alert.setView(inputName);//w w w .j ava2s . c om alert.setPositiveButton("Go", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { HijackActivity.this.webview.loadUrl(inputName.getText().toString()); } }); alert.show(); }
From source file:com.photon.phresco.hybrid.eshop.activity.PhrescoActivity.java
/** * Show the error message dialog box with OK button * /* www .jav a 2 s .co m*/ * @param errorMessage */ public void showErrorDialog(String errorMessage) { try { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(errorMessage).setTitle(R.string.app_name).setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); // System.runFinalizersOnExit(true); android.os.Process.killProcess(android.os.Process.myPid()); } }); @SuppressWarnings("unused") AlertDialog alert = builder.show(); } catch (Exception ex) { PhrescoLogger.info(TAG + "showErrorDialog: " + ex.toString()); PhrescoLogger.warning(ex); } }
From source file:com.emobc.android.activities.generators.FormActivityGenerator.java
/** * Check the contents of a web address to add new data to existing * app.xml file. Then, it goes to the next level. * @param activity//from w w w . ja v a 2 s. c o m */ protected void processSubmit(Activity activity) { try { List<NameValuePair> parameters = createParameters(); try { URL url = new URL(item.getActionUrl()); RetreiveFileContentTask task = new RetreiveFileContentTask(parameters, true); task.execute(url); try { String text = task.get(); ApplicationData.mergeAppDataFromString(activity, text); showNextLevel(activity, item.getNextLevel()); } catch (InterruptedException e) { Log.e("FormActivityGenerator: InterruptedException: ", e.getMessage()); } catch (ExecutionException e) { Log.e("FormActivityGenerator: ExecutionException: ", e.getMessage()); } } catch (MalformedURLException e1) { } } catch (final RequiredFieldException e) { final AlertDialog.Builder dlg = new AlertDialog.Builder(activity); dlg.setTitle(R.string.form_level_title); dlg.setMessage(R.string.form_level_alert_required_fields); dlg.setNeutralButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { View view = controlsMap.get(e.getDataItem().getFieldName()); view.requestFocus(); } }); dlg.show(); } }
From source file:de.trier.infsec.koch.droidsheep.activities.HijackActivity.java
private void selectURL() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getString(R.string.changeurl)); alert.setMessage(getString(R.string.customurl)); // Set an EditText view to get user input final EditText inputName = new EditText(this); inputName.setText(HijackActivity.this.webview.getUrl()); alert.setView(inputName);//w w w. j a va 2 s.c o m alert.setPositiveButton("Go", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { HijackActivity.this.webview.loadUrl(inputName.getText().toString()); } }); alert.show(); }
From source file:net.evecom.android.log.DailyLogAddActivity.java
/** * /*from w w w . j a v a2 s.co m*/ * * @param errorMsg */ private void DialogToast(String errorMsg) { AlertDialog.Builder builder1 = new AlertDialog.Builder(DailyLogAddActivity.this); builder1.setTitle(""); builder1.setIcon(R.drawable.qq_dialog_default_icon);// builder1.setMessage("" + errorMsg); builder1.setPositiveButton("", new DialogInterface.OnClickListener() { // @Override public void onClick(DialogInterface dialog, int which) { } }); builder1.show(); }
From source file:br.com.GUI.perfil.HomeAluno.java
public boolean onOptionsItemSelected(MenuItem item) { // Take appropriate action for each action item click switch (item.getItemId()) { case R.id.actSolicitacoesDeAmizadeAluno: Personal solicitacoes = new Aluno() .buscarPersonalNaoConfirmadoPorAlunoWeb(pref.getString("usuario", null)); Log.i("usuario", solicitacoes.toString()); if (solicitacoes.getUsuario() != null) { Intent i = new Intent(this, SolicitacoesDeAmizade.class); startActivity(i);/* w w w.j ava 2 s .c om*/ } else { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("Ops..."); alertDialog.setMessage(R.string.label_voce_nao_possui_solicitacoes_de_amizade); alertDialog.setIcon(R.drawable.profile); alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); // Showing Alert Message alertDialog.show(); } return true; case R.id.actLogoutAluno: finish(); Intent login = new Intent(this, Login.class); login.putExtra("logout", true); editor.clear(); editor.commit(); startActivity(login); return true; case R.id.actAdicionarPersonal: Intent adicionarAlunos = new Intent(this, BuscarUsuario.class); startActivity(adicionarAlunos); return true; case R.id.actAlterarDadosPessoaisAluno: if (pref.getBoolean("isFacebookUser", false)) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(HomeAluno.this); alertDialog.setTitle("Erro"); alertDialog.setMessage( "Seu cadastro est vinculado ao Facebook, sendo assim, no possivel alterao de informaes pessoais"); alertDialog.setIcon(R.drawable.profile); alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); // Showing Alert Message alertDialog.show(); } else { Intent alterarDados = new Intent(this, AlterarDadosPessoais.class); startActivity(alterarDados); } return true; case R.id.actPerfil: Intent perfilIntent = new Intent(this, PerfilPersonal.class); startActivity(perfilIntent); return true; case R.id.actMarcarAula: Aluno a = new Aluno().buscarAlunoEspecifico(b, pref.getString("usuario", null)); if (a.getUsuarioPersonal() != null) { Intent marcarAulaIntent = new Intent(this, MarcarAula.class); startActivity(marcarAulaIntent); } else { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("Ops..."); alertDialog.setMessage("Antes de voc agendar uma aula necessrio que voc " + " possua um treinador para lhe auxiliar na sua rotina de exerccios"); alertDialog.setIcon(R.drawable.horarios); alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); // Showing Alert Message alertDialog.show(); } return true; case R.id.actNovaAvaliacao: Intent avaliacoesIntent = new Intent(this, AvaliarGorduraCorporal.class); startActivity(avaliacoesIntent); return true; } return false; }
From source file:com.irccloud.android.fragment.EditConnectionFragment.java
private void init(View v) { channelsWrapper = (LinearLayout) v.findViewById(R.id.channels_wrapper); presets = (Spinner) v.findViewById(R.id.presets); hostname = (EditText) v.findViewById(R.id.hostname); port = (EditText) v.findViewById(R.id.port); ssl = (SwitchCompat) v.findViewById(R.id.ssl); nickname = (EditText) v.findViewById(R.id.nickname); realname = (EditText) v.findViewById(R.id.realname); channels = (EditText) v.findViewById(R.id.channels); nickserv_pass = (EditText) v.findViewById(R.id.nickservpassword); join_commands = (EditText) v.findViewById(R.id.commands); server_pass = (EditText) v.findViewById(R.id.serverpassword); network = (EditText) v.findViewById(R.id.network); presets.setOnItemSelectedListener(new OnItemSelectedListener() { @Override// www. j a v a 2 s.com public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position == 0) { if (server != null) { hostname.setText(server.hostname); port.setText(String.valueOf(server.port)); ssl.setChecked(server.ssl == 1); } else { if (default_hostname != null) hostname.setText(default_hostname); else hostname.setText(""); port.setText(String.valueOf(default_port)); ssl.setChecked(default_port == 6697); } } else { PresetServersAdapter.PresetServer s = (PresetServersAdapter.PresetServer) adapter .getItem(position); hostname.setText(s.host); port.setText(String.valueOf(s.port)); ssl.setChecked(s.port == 6697); } } @Override public void onNothingSelected(AdapterView<?> parent) { if (server != null) { hostname.setText(server.hostname); port.setText(String.valueOf(server.port)); ssl.setChecked(server.ssl == 1); } else { if (default_hostname != null) hostname.setText(default_hostname); else hostname.setText(""); port.setText(String.valueOf(default_port)); ssl.setChecked(default_port == 6697); } } }); if (NetworkConnection.getInstance().getUserInfo() != null && !NetworkConnection.getInstance().getUserInfo().verified) { Button b = (Button) v.findViewById(R.id.resend); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { NetworkConnection.getInstance().resend_verify_email(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("Confirmation Sent"); builder.setMessage("You should shortly receive an email with a link to confirm your address."); builder.setNeutralButton("Close", null); builder.show(); } }); v.findViewById(R.id.unverified).setVisibility(View.VISIBLE); } }
From source file:dtu.ds.warnme.app.activity.MainActivity.java
@Override public void onCredentialsExpired() { updateUserInterface();/*from w w w . j a va 2 s . c o m*/ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert).setTitle(R.string.credentials_expired) .setMessage(R.string.credentials_expired_desc) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Nothing to do here... } }); dialogBuilder.show(); }
From source file:com.phonegap.Notification.java
/** * Builds and shows a native Android alert with given Strings * @param message The message the alert should display * @param title The title of the alert * @param buttonLabel The label of the button * @param callbackId The callback id// w w w. ja v a 2s . com */ public synchronized void alert(final String message, final String title, final String buttonLabel, final String callbackId) { final PhonegapActivity ctx = this.ctx; final Notification notification = this; Runnable runnable = new Runnable() { public void run() { AlertDialog.Builder dlg = new AlertDialog.Builder(ctx); dlg.setMessage(message); dlg.setTitle(title); dlg.setCancelable(false); dlg.setPositiveButton(buttonLabel, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); notification.success(new PluginResult(PluginResult.Status.OK, 0), callbackId); } }); dlg.create(); dlg.show(); }; }; this.ctx.runOnUiThread(runnable); }