Code example for DialogFragment

Methods: dismiss, getTargetFragment

0
    public void onColorSelected(int color) {
        if (mListener != null) {
            mListener.onColorSelected(color);
        } 
 
        if (getTargetFragment() instanceof OnColorSelectedListener) {
            final OnColorSelectedListener listener =
                    (OnColorSelectedListener) getTargetFragment();
            listener.onColorSelected(color);
        } 
 
        if (color != mSelectedColor) {
            mSelectedColor = color;
            // Redraw palette to show checkmark on newly selected color before dismissing. 
            mPalette.drawPalette(mColors, mSelectedColor);
        } 
 
        dismiss();
    } 
 
    public void showPaletteView() { 
        if (mProgress != null && mPalette != null) {
            mProgress.setVisibility(View.GONE);
Experience pair programming with AI  Get Codota for Java