Use getActivity() to retrieve the listener.
Add check on name's length.

Disable the positive button if the name is empty, to prevent
invisible items to be created.