- public void onAttach(Context context) {
- super.onAttach(context);
- fab = ((Activity) context).findViewById(R.id.fab);
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ Activity context = getActivity();
+ if (context == null) return;
+
+ fab = context.findViewById(R.id.fab);