title: Error - Attempt to invoke virtual method 'int android.graphics.Bitmap.getHeight()' on a null object reference
body: <p>I'm trying to change the height and the width from fixed to match parent or wrap content when images are loaded into the recycler view <a href="https://stackoverflow.com/a/67860281/15537898">https://stackoverflow.com/a/67860281/15537898</a>  here is the answer I'm trying to implement but after it gives me this error</p>
  <blockquote>
  <p>Attempt to invoke virtual method 'int
  android.graphics.Bitmap.getHeight()' on a null object reference</p>
  </blockquote>
  <p><strong>Fragment_Search.java</strong></p>
  <pre><code>ShapeableImageView siv;
      Bitmap bm;
      int height = bm.getHeight();
      int width = bm.getWidth();
  
      @Nullable
      @Override
      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_search, container, false);
          requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
          postRecyclerView = view.findViewById(R.id.postRecyclerView);
          siv = view.findViewById(R.id.imageView);
          ViewGroup.LayoutParams params = siv.getLayoutParams();
          params.height = height;
          params.width = width;
          postRecyclerView.setLayoutManager(
                  new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
          );
          params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
          params.width = ViewGroup.LayoutParams.MATCH_PARENT;
          getData();
          mUploads = new ArrayList&lt;&gt;();
          postsAdapter = new PostAdapter_Search(getContext(), mUploads);
          postRecyclerView.setAdapter(postsAdapter);
          return view;
      }
  </code></pre>