I have a project that records image and name of a product registration in firebase and I'm trying to load those images into a recyclerview, but stopped at getDownloadUrl. Since I am a beginner I have researched more without success. If anyone can help me find a solution, I appreciate it.
if (mImageUri != null) {
final StorageReference fileReference = mStorageRef.child( System.currentTimeMillis()
+ "." + getFileExtencion( mImageUri ) );
mUploadTask = fileReference.putFile( mImageUri ).addOnSuccessListener( new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Handler handler = new Handler();
handler.postDelayed( new Runnable() {
@Override
public void run() {
mProgressBar.setProgress( 0 );
}
}, 500 );
// Toast.makeText( Produtos.this,"Upload com sucesso",Toast.LENGTH_SHORT ).show();
Upload upload = new Upload( mEdtName.getText().toString().trim(),
taskSnapshot.(AQUI TERIA QUE ENTRAR O CODIGO getDownloadUrl() MAS NÃO ACEITA).toString() );
String uploadId = mDatabaseRef.push().getKey();
mDatabaseRef.child( uploadId ).setValue( upload );
}
} )
.addOnFailureListener( new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText( Produtos.this, e.getMessage(), Toast.LENGTH_SHORT ).show();
}
} )
.addOnProgressListener( new OnProgressListener<UploadTask.TaskSnapshot>() {
@Override
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
double progress = (100.0 * taskSnapshot.getBytesTransferred() / taskSnapshot.getTotalByteCount());
mProgressBar.setProgress( (int) progress );
}
} );
}
}