# #java #android #google-cloud-firestore #google-cloud-storage
Вопрос:
Это мой дизайн, может ли кто-нибудь помочь мне, как я могу загружать все изображения, когда пользователь нажимает
saveBtn
любой может рассказать, как достичь этого средствами (в соответствии с моим дизайном, изображением или фотографией).
Я пробовал это, но я не знаю, что делать дальше
Я использую :
- FIREBASE FIRESTORE
- ХРАНИЛИЩЕ FIREBASE
У меня есть этот первый способ выбрать изображение из галереи
private void chooseImage(int requestCode) {
// Defining Implicit Intent to mobile gallery
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Image from here..."), requestCode);
}
I am Create this method for choosing diff Images
private void setImage(int requestCode, int resultCode, Intent data,
int requestNo, ImageView imageView, Uri filePath) {
if (requestCode == requestNo amp;amp; resultCode == RESULT_OK amp;amp; data != null amp;amp; data.getData() != null) {
// Get the Uri of data
filePath = data.getData();
// Setting image on image view using Bitmap
Bitmap bitmap = null;
if (filePath != null) {
imageView.setVisibility(View.VISIBLE);
try {
bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
} catch (IOException e) {
e.printStackTrace();
}
imageView.setImageBitmap(bitmap);
} else
imageView.setVisibility(View.GONE);
}
}
And I am Calling That Method ( setImage()
) in onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//Note: img1 and img2 is my ImageView that is Global variable. And filePath1, filePath2 is my Uri is also Global
//Variable
setImage(requestCode, resultCode, data, 10, img1, filePath1);
setImage(requestCode, resultCode, data, 11, img2, filePath2);
}
And The Real Problem Start From Here
I have to upload data in firestore like this:
- img1 — «img1Url»
- img2 — «img2Url»
this is my method to upload data to firestore —
private void uploadData(String img1Url,String img2Url){
Map<String,Object> map = new HashMap<>();
map.put("img1Url",img1Url);
map.put("img1Url",img2Url);
}
But Here I am Confuse How to upload 2 or more Images and How can I get both or more images URL to call my UploadData()
method