'How can i get data back from this dialog fragment in this code?

I have tried, but doesn't work. Let me show more details ok?

I have this on my activity:

mainActivity

xTipo.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        new ListTipo().show(getSupportFragmentManager(),"ListTipo");
    }
});

And i have this java code to my DialogFragment

Dialog Fragment:

public class ListTipo extends DialogFragment {
    
        @NonNull
        @Override
        public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) 
         {
    
            int style = DialogFragment.STYLE_NORMAL, theme = 0;
            theme = R.style.dTheme;
            setStyle(style, theme);
            String [] tipos = getActivity().getResources().getStringArray(R.array.tipo_atendimento);
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), theme);
            builder.setTitle("\b\b\bTipo de Atendimento");
            builder.setItems(tipos, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
            }
        });
        return builder.create();
    }
}

This work fine, but I can't pick up the result. Thank you for your time and patient!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source