I use below code to show folder list in AlertDialog:
ListDialog = new AlertDialog.Builder(MyActivity.this);
ListDialog.setTitle("Folder List");
ListView folder = new ListView(MyActivity.this);
//scan folder
folder.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v, int position, long id) {
//scan sub-folder
});
ListDialog.setPositiveButton("Save", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
//do something
}
});
ListDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
//back
}
});
I want to make the AlertDialog’s NegativeButton always show, and the AlertDialog’s PositiveButton only show while the list item number is 0.
How to arrive it?
try this, it work fine..
Call Dialog Method Like this,,,,