Advertisement
Star1111

Untitled

Mar 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. public class Dialog extends AppCompatDialogFragment {
  2.    
  3.     DialogListener mListener;
  4.     private String color
  5.    //Some code
  6.    
  7.    
  8.     @Override
  9.     public void onAttach(Context context) {
  10.        
  11.         super.onAttach(context);
  12.         try {
  13.             mListener = (DialogListener) getActivity();
  14.         } catch (ClassCastException e) {
  15.             throw new ClassCastException(getActivity().toString() + MUST_IMPLEMENT_INTERFACE_MESSAGE);
  16.         }
  17.     }
  18.    
  19.    
  20.    
  21.     private void returnResult() {
  22.        
  23.        
  24.  //Some code
  25.             mListener.onButtonClick(color);
  26.        
  27.     }
  28.  
  29.     public interface DialogListener {
  30.        
  31.         void onButtonClick(String color);
  32.        
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement