My goal is to permanently add an item to an existing AlertDialog.
The XML array for the AlertDialog is:
-
You can leave the defaults in the xml file but you'll need to store the custom servers in a database. Then you can pull from both sources into a single array and put that in the dialog.
final CharSequence[] items = {"Red", "Green", "Blue"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Pick a color");
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
}
});
AlertDialog alert = builder.create();