When I am trying to hide RelativeLayout in my Fragment I get an Exception that RelativeLayout.setVisibility throws null point Exception.
Here is my Fragment code:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.product_description_zoom_image,container,false);
layout = view.findViewById(R.id.layout_fix);
layout.setVisibility(View.GONE);
return view;
}
and
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:id="@+id/layout_fix">
<Button
android:layout_width="190dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@drawable/border"
android:id="@+id/btnFavourite"
android:text="@string/add_to_favourite"
android:drawableLeft="@drawable/ic_favorite_border_black_24dp"/>