Android firebase的图像未显示在recycleView中

Android firebase的图像未显示在recycleView中,android,firebase,Android,Firebase,在上面的图片中,最后一个没有出现在回收视图中,原因是什么。 我的主要活动代码如下所示,您可以检查这有什么问题。所有第一批图像都由IOS应用程序上传,并显示在回收视图中。但当我从手机上传图像时,它不会显示在RecycleView中 personPicture.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { I

在上面的图片中,最后一个没有出现在回收视图中,原因是什么。 我的主要活动代码如下所示,您可以检查这有什么问题。所有第一批图像都由IOS应用程序上传,并显示在回收视图中。但当我从手机上传图像时,它不会显示在RecycleView中

    personPicture.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent chooseProfilePictureFromGallery = new Intent(Intent.ACTION_GET_CONTENT);
            chooseProfilePictureFromGallery.setType("image/*");
            if (chooseProfilePictureFromGallery.resolveActivity(getApplicationContext().getPackageManager()) != null) {
                startActivityForResult(Intent.createChooser(chooseProfilePictureFromGallery, "Select Picture"), PICK_IMAGE);
            }
        }
    });
    UButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
                if(checkValidity()==true)
                {
                    detailInfoUpload();
                }



        }
    });
}

private boolean checkValidity() {
    String name = pName.getText().toString();
    String age = pAge.getText().toString().trim();
    String contactNumber = pNumber.getText().toString().trim();
    String address = pFullAddress.getText().toString();
    if(name.isEmpty())
    {
        Toast.makeText(getApplicationContext(),"Please give a name",Toast.LENGTH_SHORT).show();
        return false;
    }
    else if(age.isEmpty())
    {
        Toast.makeText(getApplicationContext(),"Please give proper age",Toast.LENGTH_SHORT).show();
        return false;
    }
    else if(contactNumber.isEmpty() || contactNumber.length()<11)
    {
        Toast.makeText(getApplicationContext(),"Please give contact number",Toast.LENGTH_SHORT).show();
        return false;
    }
    else if(address.isEmpty())
    {
        Toast.makeText(getApplicationContext(),"Please give a name",Toast.LENGTH_SHORT).show();
        return false;
    }

    return true;
}


private void showToast() {
    Toast.makeText(getApplicationContext(), "Information Uploaded Successfully ", Toast.LENGTH_SHORT).show();
}

private void detailInfoUpload() {
    if (FilePathUri != null) {
        final ProgressDialog progressDialog = new ProgressDialog(this);
        progressDialog.setTitle("Uploading");
        progressDialog.show();
        String uName = pName.getText().toString().trim();
        String uAge = pAge.getText().toString();
        String uBelong = pBelong.getText().toString().trim();
        String uDC = pDisappearedCity.getText().toString().trim();
        String uDD = pDisappearedDate.getText().toString().trim();
        String uAdd = pFullAddress.getText().toString();
        String uPh = pNumber.getText().toString().trim();
        String uId = firebaseAuth.getInstance().getCurrentUser().getUid();
       databaseReference = FirebaseDatabase.getInstance().getReference();
       String postid = databaseReference.child("missing_requests").push().getKey();
        StorageReference storageReference2 = storageReference.child(postid+ "." + GetFileExtension(FilePathUri));
        storageReference2.putFile(FilePathUri)
                .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
                    @Override
                    public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                        Handler handler = new Handler();
                        handler.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                progressDialog.setProgress(0);
                            }
                        }, 500);
                        PostMissingModel postMissingModel = new PostMissingModel(uAdd,uAge, uBelong,
                                uDD,uDC,genderT,taskSnapshot.getUploadSessionUri().toString(),postid,uName,statusT,uPh,uId);
                        //String ImageUploadId = databaseReference.push().getKey();
                        Log.d("mes","we are in just above uploading method");
                        databaseReference.child("missing_requests").push().setValue(postMissingModel);
                        showToast();
                        finish();
                    }
                })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception exception) {
                        progressDialog.dismiss();
                        Toast.makeText(getApplicationContext(), exception.getMessage(), Toast.LENGTH_LONG).show();
                    }
                })

                .addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
                    @Override
                    public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
                        //displaying the upload progress
                        double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount();
                        progressDialog.setMessage("Uploaded " + ((int) progress) + "%...");
                    }
                });

    }
    else {

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == PICK_IMAGE && resultCode == RESULT_OK && data != null && data.getData() != null) {

        FilePathUri = data.getData();

        try {
            Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), FilePathUri);
            personPicture.setImageBitmap(bitmap);
        } catch (IOException e) {

            e.printStackTrace();
        }

    }
}
public String GetFileExtension(Uri uri) {

    ContentResolver contentResolver = getContentResolver();
    MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
    return mimeTypeMap.getExtensionFromMimeType(contentResolver.getType(uri)) ;

}

}使用jpeg图像,用户可以使用一个名为毕加索的库

从该URL获取依赖项并将其添加到Gradle文件中,然后使用该代码:

Picasso.get().load("YOUR IMAGE URL HERE").into(imageView);

如果无法使用,请与我们共享代码?

请共享您的代码。可能您的文件类型不同。检查您正在上载的位置文件类型应为精确格式。共享请检查itI已检查。上传没有问题。图像已成功上载,但未检索要从firebase检索图像,请首先将其url存储到realtimedatabase,然后使用代码从firebse获取该url,第三个用户Picaso要将图像设置为RecycleView我只想查看代码,关于如何将它们设置为“循环视图”,所有图像都将检索到“循环视图”,我上载的最后一个图像没有显示。我认为循环视图是可以的,因为循环视图中显示了前8幅图像,这些图像是由另一个人使用IOS AppApp在连续工作3小时后上传的,解决了问题