title: BottomSheet Image Picker
body: <p>I have a project that requires some images to be uploaded. I have done it successfully, but the user has to click 6 buttons to get 6 images on the screen. Not very efficient, so I asked around and I was told to use imagepicker.</p>
  
  <p>I have implemented this <a href="https://github.com/siralam/BSImagePicker" rel="nofollow noreferrer">https://github.com/siralam/BSImagePicker</a> and it makes everything easy, but I am really struggling(no clue) on how to get those image to upload to storage and have the path stored in database.</p>
  
  <p>The way I know it is to get the <code>mimage1Uri = data.getData();</code> on the onActivityResult.</p>
  
  <p>Could someone help me get the uri?</p>
  
  <p>I apologize if you find this question too much of a burden. </p>
  
  <pre class="lang-java prettyprint-override"><code>public class PostFragment extends Fragment implements BSImagePicker.OnMultiImageSelectedListener {
  
      private ImageView ivImage1, ivImage2, ivImage3, ivImage4, ivImage5, ivImage6;
      private EditText mTitle, mDescription, mPrice, mCountry, mStateProvince, mCity, mContactEmail;
      private Button mPost;
      private ProgressBar mProgressBar;
      private double mProgress = 0;
      private Uri mSelectedUri;
      private Uri mSelectedUri1;
      private byte[] mUploadBytes;
  
  
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          View view = inflater.inflate(R.layout.fragment_post, container, false);
          ivImage1 = view.findViewById(R.id.iv_image1);
          ivImage2 = view.findViewById(R.id.iv_image2);
          ivImage3 = view.findViewById(R.id.iv_image3);
          ivImage4 = view.findViewById(R.id.iv_image4);
          ivImage5 = view.findViewById(R.id.iv_image5);
          ivImage6 = view.findViewById(R.id.iv_image6);
          mTitle = view.findViewById(R.id.input_title);
  
  
          getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
  
  
          view.findViewById(R.id.tv_multi_selection).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  BSImagePicker pickerDialog = new BSImagePicker.Builder("")
                          .setMaximumDisplayingImages(Integer.MAX_VALUE)
                          .isMultiSelect()
                          .setMinimumMultiSelectCount(3)
                          .setMaximumMultiSelectCount(6)
                          .build();
                  pickerDialog.show(getChildFragmentManager(), "picker");
              }
          });
  
          startPosting();
  
          return view;
      }
          public void onMultiImageSelected(List&lt;Uri&gt; uriList, String tag) {
          for (int i = 0; i &lt; uriList.size(); i++) {
  
              if (i &gt;= 6) return;
              ImageView iv;
              switch (i) {
                  case 0:
                      iv = ivImage1;
  
                      break;
                  case 1:
                      iv = ivImage2;
                      break;
                  case 2:
                      iv = ivImage3;
                      break;
                  case 3:
                      iv = ivImage4;
                      break;
                  case 4:
                      iv = ivImage5;
                      break;
                  case 5:
                  default:
                      iv = ivImage6;
              }
              Glide.with(this).load(uriList.get(i)).into(iv);
  </code></pre>