Advertisement
jakariamasud

function_bug

Jun 4th, 2020
739
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1.    
  2. //just replace the function of addBookFragment's uploadImage with the following function
  3. //the problem was due to the change of the api of firebase database
  4. //hope it will work
  5. private void UploadImage() {
  6.          fileRef=mStorageRef.child(fileName);
  7.         UploadTask uploadTask= fileRef.putFile(selectedImageURI);
  8.         uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
  9.             @Override
  10.             public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
  11.                 taskSnapshot.getStorage().getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
  12.                     @Override
  13.                     public void onSuccess(Uri uri) {
  14.                         coverLink= uri.toString();
  15.                         Log.e("problem","save to database state");
  16.                         updateTheDatabse();
  17.                     }
  18.                 });
  19.  
  20.  
  21.  
  22.             }
  23.         }).addOnFailureListener(new OnFailureListener() {
  24.             @Override
  25.             public void onFailure(@NonNull Exception e) {
  26.  
  27.             }
  28.         });
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement