Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //just replace the function of addBookFragment's uploadImage with the following function
- //the problem was due to the change of the api of firebase database
- //hope it will work
- private void UploadImage() {
- fileRef=mStorageRef.child(fileName);
- UploadTask uploadTask= fileRef.putFile(selectedImageURI);
- uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
- @Override
- public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
- taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
- @Override
- public void onSuccess(Uri uri) {
- coverLink= uri.toString();
- Log.e("problem","save to database state");
- updateTheDatabse();
- }
- });
- }
- }).addOnFailureListener(new OnFailureListener() {
- @Override
- public void onFailure(@NonNull Exception e) {
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement