pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edvin Syse <ed...@sysedata.no>
Subject What about an ArrayAdapter(T...) constructor?
Date Wed, 18 May 2011 20:11:57 GMT
I created a simple "Confirm Delete" Alert dialog, and ended up with this 
code:

String title = "Confirm delete"?";
new Alert(MessageType.QUESTION, title, new ArrayAdapter(new String[] { 
"Delete", "Cancel" })).open(window, new DialogCloseListener() {
     public void dialogClosed(Dialog dialog, boolean modal) {
         do something with ((Alert)dialog).getSelectedOption());
     }
});

It would be nice if I didn't need to add the noice in the ArrayAdapter 
constructor, so I could write:

new ArrayAdapter("Delete", "Cancel"). I can imagine this would be handy 
in many situations.

The fix is to change the constructor in ArrayAdapter from:

     public ArrayAdapter(T[] array)

to

     public ArrayAdapter(T... array)

-- Edvin

Mime
View raw message