If you don't use createChooser()
, the system will still present the chooser dialog unless the user has already expressed their decision as to which installed program to use for the given task (or they have withdrawn their previous decision).
If you do use createChooser()
, the system will always present the dialog, even if there already is an expressed preference.
So, both are absolutely correct, you have to decide which one to use in any given case. Your mileage might vary, but basically, if you offer up a format like a text, an image, a video or similar for display or editing, you probably want to omit createChooser()
so that whatever the user already prefers can start immediately. On the other hand, if you want to share something that you expect the user to handle with a different installed program (say, send an e-mail, Facebook, chat, whatever) every time, you probably want to use createChooser()
to make it easy for your user to select on the fly.