Use of Android AlertDialog dialogue panel—Android development

1 AlertDialog.Builder builder=new AlertDialog.Builder(this); 2 builder.setTitle(“History”).setIcon(R.mipmap.info).setMessage(str) 3.setPositiveButton(“ok”, new DialogInterface.OnClickListener() { 4 @Override 5 public void onClick(DialogInterface dialog, int which) { 6} 7 }); 8 AlertDialog ad=builder.create(); 9 ad.show(); The result displayed by the above code is as shown in the figure. Briefly record the usage of AlertDialog: The following content is compiled from: https://blog.csdn.net/streate/article/details/90899515 1. […]

2023-04-28 Use of Android AlertDialog Modify title, content, font size and font color of buttons, customize interface with input box, etc.

1. Effect 1 1.1 The interface is as follows 1.2 Code private void NoPermissionsHintDialog() { AlertDialog.Builder alert_builder = new AlertDialog.Builder(m_context); alert_builder.setTitle(“Warning”) .setIcon(R.drawable.warning_icon) .setMessage(“Please grant permissions firstly!”) //.setView(inputServer) //.setView(mView) .setNegativeButton(“Quit”, new DialogInterface. OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog. dismiss(); exit(0); } }) .setPositiveButton(“Grant”, new DialogInterface. OnClickListener() { @Override public void onClick(DialogInterface […]