Builder alert = new AlertDialog.Builder(screen4.this); alert.setTitle("Doctor"); alert.setMessage("message"); alert.setPositiveButton("OK",null); alert.show();
Builder myCustomDialog = new AlertDialog.Builder(yourContext); LayoutInflater factory = LayoutInflater.from(context); final View yourInflatedView = factory.inflate(R.layout.your_xml_layout, null); //Here you get your imageView (or TextView, EditText,...) ImageView img1 = (ImageView) yourInflatedView.findViewById(R.id.img1); // Do stuff with your imageview... myCustomDialog.setView(yourInflatedView); myCustomDialog.show();
Builder builder = new AlertDialog.Builder(context); builder.setTitle(""); ... builder.show();
final EditText text = (EditText)findViewById(R.id.eTb); final Builder vars = new AlertDialog.Builder(this); Button savedvars = (Button) findViewById(R.id.showButton); savedvars.setOnClickListener(new OnClickListener() { public void onClick(View v) { String convtext = text.getText().toString(); vars.setTitle("Saved Information"); vars.setMessage("Entered Text: " + convtext); vars.show(); } });
protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Builder builder = new AlertDialog.Builder(this); builder.setMessage(item[position] + " is clicked."); builder.setPositiveButton("OK", null); builder.show(); }
Resources res = getResources(); InputStream in_s = res.openRawResource(R.raw.eula); BufferedReader reader = new BufferedReader(new InputStreamReader(in_s)); String key1 = preference.getKey(); //if the user click on the Legal Notices preference, display the license if (key1.equalsIgnoreCase("prefEULA")){ String eulaContent = ""; try { while ((reader.readLine()) != null) { eulaContent += reader.readLine(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Builder eulaDialog = new AlertDialog.Builder(this); eulaDialog.setTitle("End-User Licence Agreement"); if (eulaContent!=null){ eulaDialog.setMessage(eulaContent); eulaDialog.show(); } }
Resources res = getResources(); InputStream in_s = res.openRawResource(R.raw.eula); BufferedReader reader = new BufferedReader(new InputStreamReader(in_s)); String key = preference.getKey(); //if the user click on the Legal Notices preference, display the license if (key.equalsIgnoreCase("prefEULA")){ String eulaContent = ""; try { String line = null; while ((line = reader.readLine()) != null) { eulaContent += line + "\n"; } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Builder eulaDialog = new AlertDialog.Builder(this); eulaDialog.setTitle("End User License Agreement"); if (eulaContent!=null){ eulaDialog.setMessage(eulaContent); eulaDialog.show(); } }
TextView tv = new TextView(this); tv.setText("Holo every where"); Builder builder= new org.holoeverywhere.app.AlertDialog.Builder(this); builder.setTheme(AlertDialog.THEME_HOLO_LIGHT); builder.setView(tv) .setPositiveButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // tasks } }).setNegativeButton("Cancel", null).setTitle("title"); builder.show();
Builder alert = new AlertDialog.Builder(ActivityName.this); alert.setTitle("Doctor"); alert.setMessage("message"); alert.setPositiveButton("OK",null); alert.show();
public void showDialog(String title,String message) { Builder builder = new Builder(global_context); builder.setCancelable(true); builder.setTitle(title); builder.setMessage(message); builder.show(); } //this is not custom dialog // intead of this method you can put your custom Dialog code
if(audioFile.exists()) { intent.setDataAndType(Uri.fromFile(audioFile), "audio/mp3"); startActivity(intent); } else { Builder alert = new AlertDialog.Builder(activity_name.this); alert.setTitle("Alert"); alert.setMessage("File does not exist"); alert.setPositiveButton("OK", null); alert.show(); }
dialogb.show(); return false;
@Override public void remove(int which) { Builder builder = new AlertDialog.Builder(context); builder.setPositiveButton(R.string.your_button_title, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // do some custom delete code (e.g delete datamodel) } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // call notifyDataSetChanged() on your adapter otherwise it will be gone! } }); builder.setTitle(R.string.your_title); builder.setMessage(context.getString(R.string.your_message)); builder.show(); }
Location location = new Helper().getGPSLocation(context); if(location != null) { latitude = (int) (location.getLatitude() * 1E6); longitude = (int) (location.getLongitude() * 1E6); } else { Builder alert = new Builder(context); alert.setTitle(R.string.app_name); alert.setMessage(context.getString(R.string.enable_use_wireless_network)); alert.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); context.startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)); } }); alert.show(); }
@Override public void onClick(View arg0) { LoadData task = new LoadData(); task.execute(); construction AlertDialog.Builder builder = new AlertDialog.Builder(Destination.this); builder.setMessage("Press 'Ok' ") .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { AlertDialog alertDialog = new AlertDialog.Builder(Destination.this).create(); alertDialog.setTitle("Attention!"); alertDialog.setMessage(" Pay attention"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); alertDialog.show(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // do nothing } }); builder.create(); builder.show();
private boolean delete_confirm() { boolean confirm = false; // confirm delete Builder confirmation = new AlertDialog.Builder(this); // set message, title confirmation.setTitle("Delete"); confirmation.setMessage("Do you want to Delete"); confirmation.setPositiveButton("Delete", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); confirm = true; } }); confirmation.setNegativeButton("cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); confirm = false; } }); confirmation.create(); confirmation.show(); return confirm;
/** * Show the diff recursively * * @param p * @param i */ private void show(Diff p, String indent, boolean warning) { Delta d = p.getDelta(); if (d == Delta.UNCHANGED) return; if (warning) warning("%s%s", indent, p); else error("%s%s", indent, p); indent = indent + " "; switch (d) { case CHANGED : case MAJOR : case MINOR : case MICRO : break; default : return; } for (Diff c : p.getChildren()) show(c, indent, warning); }
/** * Show the diff recursively * * @param p * @param i */ private void show(Diff p, String indent, boolean warning) { Delta d = p.getDelta(); if (d == Delta.UNCHANGED) return; if (warning) warning("%s%s", indent, p); else error("%s%s", indent, p); indent = indent + " "; switch (d) { case CHANGED : case MAJOR : case MINOR : case MICRO : break; default : return; } for (Diff c : p.getChildren()) show(c, indent, warning); }
/** * Show the diff recursively * * @param p * @param i */ private void show(Diff p, String indent, boolean warning) { Delta d = p.getDelta(); if (d == Delta.UNCHANGED) return; if (warning) warning("%s%s", indent, p); else error("%s%s", indent, p); indent = indent + " "; switch (d) { case CHANGED : case MAJOR : case MINOR : case MICRO : break; default : return; } for (Diff c : p.getChildren()) show(c, indent, warning); }
/** * Show the diff recursively * * @param p * @param i */ private void show(Diff p, String indent, boolean warning) { Delta d = p.getDelta(); if (d == Delta.UNCHANGED) return; if (warning) warning("%s%s", indent, p).header("-diff"); else error("%s%s", indent, p).header("-diff"); indent = indent + " "; switch (d) { case CHANGED : case MAJOR : case MINOR : case MICRO : break; default : return; } for (Diff c : p.getChildren()) show(c, indent, warning); }