Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Dialog extends AppCompatDialogFragment {
- DialogListener mListener;
- private String color
- //Some code
- @Override
- public void onAttach(Context context) {
- super.onAttach(context);
- try {
- mListener = (DialogListener) getActivity();
- } catch (ClassCastException e) {
- throw new ClassCastException(getActivity().toString() + MUST_IMPLEMENT_INTERFACE_MESSAGE);
- }
- }
- private void returnResult() {
- //Some code
- mListener.onButtonClick(color);
- }
- public interface DialogListener {
- void onButtonClick(String color);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement