Tuesday 18 April 2017

Android List Popup

private void showList(){
   List<String> partyList = new ArrayList<String>();
// Create sequence of items
final CharSequence[] party = partyList.toArray(new String[partyList
.size()]);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
dialogBuilder.setTitle("Select Party");
dialogBuilder.setItems(party, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
String selectedText = party[item].toString(); // Selected item
partyBtn.setText(selectedText);
Constants.party=selectedText;
}
});
// Create alert dialog object via builder
AlertDialog alertDialogObject = dialogBuilder.create();
// Show the dialog
alertDialogObject.show();
// ///////////////////////
}

No comments:

Post a Comment