I am trying to implement modal bottom sheet to let user select camera / gallery / remove options in order to upload / remove profile picture.
Bottom sheet is displaying without any issues.But when user clicks on any option - Below mentioned error is being thrown.
Attempt to invoke interface method 'ImageChooserDialog$BottomSheetListener.onOptionsClicked(java.lang.String)' on a null object reference
ImageChooserDialog.java class (Modal bottom sheet):
public class ImageChooserDialog extends BottomSheetDialogFragment {
CircularImageView camera,gallery,remove;
public static final String TAG = "ImageChooserDialog";
private BottomSheetListener bottomSheetListener;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v =  inflater.inflate(R.layout.fragment_image_choose_dialog, container, false);
    camera = v.findViewById(R.id.imagechooser_camera);
    gallery = v.findViewById(R.id.imagechooser_gallery);
    remove = v.findViewById(R.id.imagechooser_remove);
    camera.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (bottomSheetListener != null)
            {
                bottomSheetListener.onOptionsClicked("Camera");
                dismiss();
            }else {
                Toast.makeText(getActivity(), "Initialize", Toast.LENGTH_SHORT).show();
            }
        }
    });
    gallery.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (bottomSheetListener != null)
            {
                bottomSheetListener.onOptionsClicked("Gallery");
                dismiss();
            }else {
                Toast.makeText(getActivity(), "Initialize", Toast.LENGTH_SHORT).show();
            }
        }
    });
    remove.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (bottomSheetListener != null)
            {
                bottomSheetListener.onOptionsClicked("Remove");
                dismiss();
            }else {
                Toast.makeText(getActivity(), "Initialize", Toast.LENGTH_SHORT).show();
            }
        }
    });
    return v;
}
@Override
public int getTheme() {
    return R.style.BottomSheetDialogTheme;
}
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    try {
        bottomSheetListener = (BottomSheetListener) getParentFragment();
    }catch (ClassCastException e)
    {
        throw new ClassCastException(context.toString()+"must implement BottomSheetListener");
    }
}
public interface BottomSheetListener{
    void onOptionsClicked(String option);
}
}
EditProfile.java class (Fragment)
public class EditProfile extends Fragment implements ImageChooserDialog.BottomSheetListener {
    //to open modal bottom sheet
private void openOptionsBox()
     {
         ImageChooserDialog fragment= new ImageChooserDialog();
         fragment.show(getFragmentManager(),ImageChooserDialog.TAG);
     }
@Override
public void onOptionsClicked(String option) {
    Toast.makeText(getContext(), ""+option, Toast.LENGTH_SHORT).show();
}
 }
Thanks in advance.
 
    