How to get url image from firebase and save it in string?How to save an Android Activity state using save instance state?How can I open a URL in Android's web browser from my application?Is there a way to get the source code from an APK file?Android AlarmManager for periodical sensor readingHow to get the build/version number of your Android application?setText on button from another activity androidget around of error 'can not resolve symbol'Saving ToggleButton state in ListView by using SharedPreferencesHow to get the data saved in a USER_ID?

Can you use Apple Care+ without any checks (bringing just MacBook)?

Can UV radiation be safe for the skin?

What is the chance of getting a Red Cabbage in year 1?

How to save money by shopping at a variety of grocery stores?

Why do presidential pardons exist in a country having a clear separation of powers?

Do universities maintain secret textbooks?

Can authors email you PDFs of their textbook for free?

What is the practical impact of using System.Random which is not cryptographically random?

Using font to highlight a god's speech in dialogue

Why does the U.S. military maintain their own weather satellites?

How many possible file types in the output `ls -l` command?

New coworker has strange workplace requirements - how should I deal with them?

Can a human variant take proficiency in initiative?

Who declared the Last Alliance to be the "last" and why?

How to run a command 1 out of N times in Bash

Which is the correct version of Mussorgsky's Pictures at an Exhibition?

Heavy Box Stacking

I failed to respond to a potential advisor

Did NASA/JPL get "waning" and "waxing" backwards in this video?

An idiom for “Until you punish the offender, they will not give up offenses”

A vector is defined to have a magnitude and *a* direction, but the zero vector has no *single* direction. So, how is the zero vector a vector?

Doubt about a particular point of view on how to do character creation

Padding a column of lists

How is the anglicism "jackpot" commonly expressed in French?



How to get url image from firebase and save it in string?


How to save an Android Activity state using save instance state?How can I open a URL in Android's web browser from my application?Is there a way to get the source code from an APK file?Android AlarmManager for periodical sensor readingHow to get the build/version number of your Android application?setText on button from another activity androidget around of error 'can not resolve symbol'Saving ToggleButton state in ListView by using SharedPreferencesHow to get the data saved in a USER_ID?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















How I can get a String url from:



StorageReference file_path = mStorageReference.child("Posts_images")
.child(currentUser + ".jpg");
file_path.putFile(pickedImageUri).addOnCompleteListener(new OnCompleteListener <UploadTask.TaskSnapshot>() {
@Override
public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
if (task.isSuccessful())
//
String msg = getString(R.string.imageUploadSuccessfully);
Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();
finish();










share|improve this question
































    1















    How I can get a String url from:



    StorageReference file_path = mStorageReference.child("Posts_images")
    .child(currentUser + ".jpg");
    file_path.putFile(pickedImageUri).addOnCompleteListener(new OnCompleteListener <UploadTask.TaskSnapshot>() {
    @Override
    public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
    if (task.isSuccessful())
    //
    String msg = getString(R.string.imageUploadSuccessfully);
    Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();
    finish();










    share|improve this question




























      1












      1








      1








      How I can get a String url from:



      StorageReference file_path = mStorageReference.child("Posts_images")
      .child(currentUser + ".jpg");
      file_path.putFile(pickedImageUri).addOnCompleteListener(new OnCompleteListener <UploadTask.TaskSnapshot>() {
      @Override
      public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
      if (task.isSuccessful())
      //
      String msg = getString(R.string.imageUploadSuccessfully);
      Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();
      finish();










      share|improve this question
















      How I can get a String url from:



      StorageReference file_path = mStorageReference.child("Posts_images")
      .child(currentUser + ".jpg");
      file_path.putFile(pickedImageUri).addOnCompleteListener(new OnCompleteListener <UploadTask.TaskSnapshot>() {
      @Override
      public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
      if (task.isSuccessful())
      //
      String msg = getString(R.string.imageUploadSuccessfully);
      Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();
      finish();







      android






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 30 at 0:21









      Jason Aller

      3,24710 gold badges32 silver badges33 bronze badges




      3,24710 gold badges32 silver badges33 bronze badges










      asked Mar 27 at 23:55









      Ali QadomyAli Qadomy

      62 bronze badges




      62 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          0















          Inside the if statement where the task is successul you can get the downloadUrl like this:



          if (task.isSuccessful()) 

          String msg = getString(R.string.imageUploadSuccessfully);
          Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();

          file_path.getDownloadUrl().addOnSuccessListener(new
          OnSuccessListener<Uri>()
          @Override
          public void onSuccess(Uri uri)
          String url = uri.toString();
          //do stuff

          ).addOnFailureListener(new OnFailureListener()
          @Override
          public void onFailure(@NonNull Exception exception)
          // Handle any errors

          );




          Documentation for more information Firebase docs






          share|improve this answer



























          • I use .addOnCompleteListener ??

            – Ali Qadomy
            Mar 28 at 0:01











          • I'm not sure what you mean by that. You should use .onSuccess listener or the getDownloadUrl()..

            – bensadiku
            Mar 28 at 0:02











          • Updated the code to fit your pasta

            – bensadiku
            Mar 28 at 0:09


















          0















          You need to use this



           .addOnCompleteListener(new OnCompleteListener<Uri>() 
          @Override
          public void onComplete(@NonNull Task<Uri> task)
          if (task.isSuccessful())
          Uri downloadUri = task.getResult();
          if (downloadUri != null)
          String photoStringUrl = downloadUri.toString();



          );





          share|improve this answer





























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388216%2fhow-to-get-url-image-from-firebase-and-save-it-in-string%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0















            Inside the if statement where the task is successul you can get the downloadUrl like this:



            if (task.isSuccessful()) 

            String msg = getString(R.string.imageUploadSuccessfully);
            Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();

            file_path.getDownloadUrl().addOnSuccessListener(new
            OnSuccessListener<Uri>()
            @Override
            public void onSuccess(Uri uri)
            String url = uri.toString();
            //do stuff

            ).addOnFailureListener(new OnFailureListener()
            @Override
            public void onFailure(@NonNull Exception exception)
            // Handle any errors

            );




            Documentation for more information Firebase docs






            share|improve this answer



























            • I use .addOnCompleteListener ??

              – Ali Qadomy
              Mar 28 at 0:01











            • I'm not sure what you mean by that. You should use .onSuccess listener or the getDownloadUrl()..

              – bensadiku
              Mar 28 at 0:02











            • Updated the code to fit your pasta

              – bensadiku
              Mar 28 at 0:09















            0















            Inside the if statement where the task is successul you can get the downloadUrl like this:



            if (task.isSuccessful()) 

            String msg = getString(R.string.imageUploadSuccessfully);
            Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();

            file_path.getDownloadUrl().addOnSuccessListener(new
            OnSuccessListener<Uri>()
            @Override
            public void onSuccess(Uri uri)
            String url = uri.toString();
            //do stuff

            ).addOnFailureListener(new OnFailureListener()
            @Override
            public void onFailure(@NonNull Exception exception)
            // Handle any errors

            );




            Documentation for more information Firebase docs






            share|improve this answer



























            • I use .addOnCompleteListener ??

              – Ali Qadomy
              Mar 28 at 0:01











            • I'm not sure what you mean by that. You should use .onSuccess listener or the getDownloadUrl()..

              – bensadiku
              Mar 28 at 0:02











            • Updated the code to fit your pasta

              – bensadiku
              Mar 28 at 0:09













            0














            0










            0









            Inside the if statement where the task is successul you can get the downloadUrl like this:



            if (task.isSuccessful()) 

            String msg = getString(R.string.imageUploadSuccessfully);
            Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();

            file_path.getDownloadUrl().addOnSuccessListener(new
            OnSuccessListener<Uri>()
            @Override
            public void onSuccess(Uri uri)
            String url = uri.toString();
            //do stuff

            ).addOnFailureListener(new OnFailureListener()
            @Override
            public void onFailure(@NonNull Exception exception)
            // Handle any errors

            );




            Documentation for more information Firebase docs






            share|improve this answer















            Inside the if statement where the task is successul you can get the downloadUrl like this:



            if (task.isSuccessful()) 

            String msg = getString(R.string.imageUploadSuccessfully);
            Toast.makeText(AddPost_Activity.this, msg, Toast.LENGTH_SHORT).show();

            file_path.getDownloadUrl().addOnSuccessListener(new
            OnSuccessListener<Uri>()
            @Override
            public void onSuccess(Uri uri)
            String url = uri.toString();
            //do stuff

            ).addOnFailureListener(new OnFailureListener()
            @Override
            public void onFailure(@NonNull Exception exception)
            // Handle any errors

            );




            Documentation for more information Firebase docs







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 28 at 0:09

























            answered Mar 27 at 23:57









            bensadikubensadiku

            3331 silver badge10 bronze badges




            3331 silver badge10 bronze badges















            • I use .addOnCompleteListener ??

              – Ali Qadomy
              Mar 28 at 0:01











            • I'm not sure what you mean by that. You should use .onSuccess listener or the getDownloadUrl()..

              – bensadiku
              Mar 28 at 0:02











            • Updated the code to fit your pasta

              – bensadiku
              Mar 28 at 0:09

















            • I use .addOnCompleteListener ??

              – Ali Qadomy
              Mar 28 at 0:01











            • I'm not sure what you mean by that. You should use .onSuccess listener or the getDownloadUrl()..

              – bensadiku
              Mar 28 at 0:02











            • Updated the code to fit your pasta

              – bensadiku
              Mar 28 at 0:09
















            I use .addOnCompleteListener ??

            – Ali Qadomy
            Mar 28 at 0:01





            I use .addOnCompleteListener ??

            – Ali Qadomy
            Mar 28 at 0:01













            I'm not sure what you mean by that. You should use .onSuccess listener or the getDownloadUrl()..

            – bensadiku
            Mar 28 at 0:02





            I'm not sure what you mean by that. You should use .onSuccess listener or the getDownloadUrl()..

            – bensadiku
            Mar 28 at 0:02













            Updated the code to fit your pasta

            – bensadiku
            Mar 28 at 0:09





            Updated the code to fit your pasta

            – bensadiku
            Mar 28 at 0:09













            0















            You need to use this



             .addOnCompleteListener(new OnCompleteListener<Uri>() 
            @Override
            public void onComplete(@NonNull Task<Uri> task)
            if (task.isSuccessful())
            Uri downloadUri = task.getResult();
            if (downloadUri != null)
            String photoStringUrl = downloadUri.toString();



            );





            share|improve this answer































              0















              You need to use this



               .addOnCompleteListener(new OnCompleteListener<Uri>() 
              @Override
              public void onComplete(@NonNull Task<Uri> task)
              if (task.isSuccessful())
              Uri downloadUri = task.getResult();
              if (downloadUri != null)
              String photoStringUrl = downloadUri.toString();



              );





              share|improve this answer





























                0














                0










                0









                You need to use this



                 .addOnCompleteListener(new OnCompleteListener<Uri>() 
                @Override
                public void onComplete(@NonNull Task<Uri> task)
                if (task.isSuccessful())
                Uri downloadUri = task.getResult();
                if (downloadUri != null)
                String photoStringUrl = downloadUri.toString();



                );





                share|improve this answer















                You need to use this



                 .addOnCompleteListener(new OnCompleteListener<Uri>() 
                @Override
                public void onComplete(@NonNull Task<Uri> task)
                if (task.isSuccessful())
                Uri downloadUri = task.getResult();
                if (downloadUri != null)
                String photoStringUrl = downloadUri.toString();



                );






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 28 at 0:29

























                answered Mar 28 at 0:19









                Mustafa ShahoudMustafa Shahoud

                367 bronze badges




                367 bronze badges






























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388216%2fhow-to-get-url-image-from-firebase-and-save-it-in-string%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript