enter image description herei uploaded some files in a storage reference in firebase and i want display those files in listview to let the user choose the specific file and download it . files of type word or powerpoint etc.. here is the code for uploading :
if (filePath != null) {
//displaying a progress dialog while upload is going on
final ProgressDialog progressDialog = new ProgressDialog(getActivity());
progressDialog.setTitle("Uploading");
progressDialog.show();
mStorageRef = FirebaseStorage.getInstance().getReference();
mStorageRef= mStorageRef.child(Coursename +"/"+ filename);
mStorageRef.putFile(filePath)
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
//if the upload is successfull
//hiding the progress dialog
progressDialog.dismiss();
//and displaying a success toast
Toast.makeText(getActivity(), "File Uploaded ", Toast.LENGTH_LONG).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
//if the upload is not successfull
//hiding the progress dialog
progressDialog.dismiss();
//and displaying error message
Toast.makeText(getActivity(), exception.getMessage(), Toast.LENGTH_LONG).show();
}
})
.addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
@Override
@SuppressWarnings("VisibleForTests")
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
//calculating progress percentage
double progress = (100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount();
//displaying percentage in progress dialog
progressDialog.setMessage("Uploaded " + ((int) progress) + "%...");
}
});
}
//if there is not any file
else {
//you can display an error toast
Log.i("errorMessage","Error");
}
}
But i cant find a proper code for listing the files here is a screenshot from the storage :
Pardon a newbie