How to hide progressbar in Android?











up vote
7
down vote

favorite
2












I added a progressbar to my app but I want to hide it after some doing some action,



I used hide(), dismiss() and cancel()... but none of them work?



How can I hide the progressbar?










share|improve this question




























    up vote
    7
    down vote

    favorite
    2












    I added a progressbar to my app but I want to hide it after some doing some action,



    I used hide(), dismiss() and cancel()... but none of them work?



    How can I hide the progressbar?










    share|improve this question


























      up vote
      7
      down vote

      favorite
      2









      up vote
      7
      down vote

      favorite
      2






      2





      I added a progressbar to my app but I want to hide it after some doing some action,



      I used hide(), dismiss() and cancel()... but none of them work?



      How can I hide the progressbar?










      share|improve this question















      I added a progressbar to my app but I want to hide it after some doing some action,



      I used hide(), dismiss() and cancel()... but none of them work?



      How can I hide the progressbar?







      android visibility android-progressbar






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 19 '16 at 6:50









      onexf

      1,63611429




      1,63611429










      asked Jan 17 '11 at 21:15









      Adham

      23.4k85202317




      23.4k85202317
























          4 Answers
          4






          active

          oldest

          votes

















          up vote
          23
          down vote













          ProgressBar.setVisibility(View.INVISIBLE) 


          should be enough.



          Edit: fixed typo.






          share|improve this answer























          • what a bout Dialog ?! how we can do that ?? it don't have setVisibilty()
            – Adham
            Jan 17 '11 at 21:46










          • Do you have a ProgressDialog, or a ProgressBar??
            – Aman Alam
            Jan 18 '11 at 7:56






          • 2




            you have a typo: should be setVisibil >i< ty
            – alex
            Apr 27 '12 at 12:21


















          up vote
          4
          down vote













          "all of them are work", that sounds like it means that they work? But then why the question?



          I'd say: get the view, en do



           myView.setVisibility(View.GONE)





          share|improve this answer





















          • I'm sorry . they aren't .. i edited it :)
            – Adham
            Jan 17 '11 at 21:36










          • but I assume setVisibility does?
            – Nanne
            Jan 18 '11 at 7:43










          • it is not working....
            – hharry
            Jul 26 '13 at 6:03


















          up vote
          3
          down vote













          ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
          progressBar.setVisibility(0); --visible
          progressBar.setVisibility(4); --invisible
          progressBar.setVisibility(8); --gone (like dismiss)





          share|improve this answer

















          • 14




            Why not progressBar.setVisibility(View.Visible); instead of using these magic numbers?
            – Rafi Kamal
            Jun 19 '14 at 14:44


















          up vote
          1
          down vote














          when you want to show it

          progressBar.visibility = View.VISIBLE




          when you want to hide it

          1 progressBar.visibility = View.GONE

          2 progressBar.visibility = View.INVISIBLE





          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',
            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%2f4717975%2fhow-to-hide-progressbar-in-android%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            23
            down vote













            ProgressBar.setVisibility(View.INVISIBLE) 


            should be enough.



            Edit: fixed typo.






            share|improve this answer























            • what a bout Dialog ?! how we can do that ?? it don't have setVisibilty()
              – Adham
              Jan 17 '11 at 21:46










            • Do you have a ProgressDialog, or a ProgressBar??
              – Aman Alam
              Jan 18 '11 at 7:56






            • 2




              you have a typo: should be setVisibil >i< ty
              – alex
              Apr 27 '12 at 12:21















            up vote
            23
            down vote













            ProgressBar.setVisibility(View.INVISIBLE) 


            should be enough.



            Edit: fixed typo.






            share|improve this answer























            • what a bout Dialog ?! how we can do that ?? it don't have setVisibilty()
              – Adham
              Jan 17 '11 at 21:46










            • Do you have a ProgressDialog, or a ProgressBar??
              – Aman Alam
              Jan 18 '11 at 7:56






            • 2




              you have a typo: should be setVisibil >i< ty
              – alex
              Apr 27 '12 at 12:21













            up vote
            23
            down vote










            up vote
            23
            down vote









            ProgressBar.setVisibility(View.INVISIBLE) 


            should be enough.



            Edit: fixed typo.






            share|improve this answer














            ProgressBar.setVisibility(View.INVISIBLE) 


            should be enough.



            Edit: fixed typo.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Oct 2 '12 at 7:47









            Leandros

            14k65693




            14k65693










            answered Jan 17 '11 at 21:17









            Jake Kalstad

            1,738920




            1,738920












            • what a bout Dialog ?! how we can do that ?? it don't have setVisibilty()
              – Adham
              Jan 17 '11 at 21:46










            • Do you have a ProgressDialog, or a ProgressBar??
              – Aman Alam
              Jan 18 '11 at 7:56






            • 2




              you have a typo: should be setVisibil >i< ty
              – alex
              Apr 27 '12 at 12:21


















            • what a bout Dialog ?! how we can do that ?? it don't have setVisibilty()
              – Adham
              Jan 17 '11 at 21:46










            • Do you have a ProgressDialog, or a ProgressBar??
              – Aman Alam
              Jan 18 '11 at 7:56






            • 2




              you have a typo: should be setVisibil >i< ty
              – alex
              Apr 27 '12 at 12:21
















            what a bout Dialog ?! how we can do that ?? it don't have setVisibilty()
            – Adham
            Jan 17 '11 at 21:46




            what a bout Dialog ?! how we can do that ?? it don't have setVisibilty()
            – Adham
            Jan 17 '11 at 21:46












            Do you have a ProgressDialog, or a ProgressBar??
            – Aman Alam
            Jan 18 '11 at 7:56




            Do you have a ProgressDialog, or a ProgressBar??
            – Aman Alam
            Jan 18 '11 at 7:56




            2




            2




            you have a typo: should be setVisibil >i< ty
            – alex
            Apr 27 '12 at 12:21




            you have a typo: should be setVisibil >i< ty
            – alex
            Apr 27 '12 at 12:21












            up vote
            4
            down vote













            "all of them are work", that sounds like it means that they work? But then why the question?



            I'd say: get the view, en do



             myView.setVisibility(View.GONE)





            share|improve this answer





















            • I'm sorry . they aren't .. i edited it :)
              – Adham
              Jan 17 '11 at 21:36










            • but I assume setVisibility does?
              – Nanne
              Jan 18 '11 at 7:43










            • it is not working....
              – hharry
              Jul 26 '13 at 6:03















            up vote
            4
            down vote













            "all of them are work", that sounds like it means that they work? But then why the question?



            I'd say: get the view, en do



             myView.setVisibility(View.GONE)





            share|improve this answer





















            • I'm sorry . they aren't .. i edited it :)
              – Adham
              Jan 17 '11 at 21:36










            • but I assume setVisibility does?
              – Nanne
              Jan 18 '11 at 7:43










            • it is not working....
              – hharry
              Jul 26 '13 at 6:03













            up vote
            4
            down vote










            up vote
            4
            down vote









            "all of them are work", that sounds like it means that they work? But then why the question?



            I'd say: get the view, en do



             myView.setVisibility(View.GONE)





            share|improve this answer












            "all of them are work", that sounds like it means that they work? But then why the question?



            I'd say: get the view, en do



             myView.setVisibility(View.GONE)






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 17 '11 at 21:16









            Nanne

            55.3k1496142




            55.3k1496142












            • I'm sorry . they aren't .. i edited it :)
              – Adham
              Jan 17 '11 at 21:36










            • but I assume setVisibility does?
              – Nanne
              Jan 18 '11 at 7:43










            • it is not working....
              – hharry
              Jul 26 '13 at 6:03


















            • I'm sorry . they aren't .. i edited it :)
              – Adham
              Jan 17 '11 at 21:36










            • but I assume setVisibility does?
              – Nanne
              Jan 18 '11 at 7:43










            • it is not working....
              – hharry
              Jul 26 '13 at 6:03
















            I'm sorry . they aren't .. i edited it :)
            – Adham
            Jan 17 '11 at 21:36




            I'm sorry . they aren't .. i edited it :)
            – Adham
            Jan 17 '11 at 21:36












            but I assume setVisibility does?
            – Nanne
            Jan 18 '11 at 7:43




            but I assume setVisibility does?
            – Nanne
            Jan 18 '11 at 7:43












            it is not working....
            – hharry
            Jul 26 '13 at 6:03




            it is not working....
            – hharry
            Jul 26 '13 at 6:03










            up vote
            3
            down vote













            ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
            progressBar.setVisibility(0); --visible
            progressBar.setVisibility(4); --invisible
            progressBar.setVisibility(8); --gone (like dismiss)





            share|improve this answer

















            • 14




              Why not progressBar.setVisibility(View.Visible); instead of using these magic numbers?
              – Rafi Kamal
              Jun 19 '14 at 14:44















            up vote
            3
            down vote













            ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
            progressBar.setVisibility(0); --visible
            progressBar.setVisibility(4); --invisible
            progressBar.setVisibility(8); --gone (like dismiss)





            share|improve this answer

















            • 14




              Why not progressBar.setVisibility(View.Visible); instead of using these magic numbers?
              – Rafi Kamal
              Jun 19 '14 at 14:44













            up vote
            3
            down vote










            up vote
            3
            down vote









            ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
            progressBar.setVisibility(0); --visible
            progressBar.setVisibility(4); --invisible
            progressBar.setVisibility(8); --gone (like dismiss)





            share|improve this answer












            ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
            progressBar.setVisibility(0); --visible
            progressBar.setVisibility(4); --invisible
            progressBar.setVisibility(8); --gone (like dismiss)






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 7 '14 at 22:31









            Stephanie

            551




            551








            • 14




              Why not progressBar.setVisibility(View.Visible); instead of using these magic numbers?
              – Rafi Kamal
              Jun 19 '14 at 14:44














            • 14




              Why not progressBar.setVisibility(View.Visible); instead of using these magic numbers?
              – Rafi Kamal
              Jun 19 '14 at 14:44








            14




            14




            Why not progressBar.setVisibility(View.Visible); instead of using these magic numbers?
            – Rafi Kamal
            Jun 19 '14 at 14:44




            Why not progressBar.setVisibility(View.Visible); instead of using these magic numbers?
            – Rafi Kamal
            Jun 19 '14 at 14:44










            up vote
            1
            down vote














            when you want to show it

            progressBar.visibility = View.VISIBLE




            when you want to hide it

            1 progressBar.visibility = View.GONE

            2 progressBar.visibility = View.INVISIBLE





            share|improve this answer

























              up vote
              1
              down vote














              when you want to show it

              progressBar.visibility = View.VISIBLE




              when you want to hide it

              1 progressBar.visibility = View.GONE

              2 progressBar.visibility = View.INVISIBLE





              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote










                when you want to show it

                progressBar.visibility = View.VISIBLE




                when you want to hide it

                1 progressBar.visibility = View.GONE

                2 progressBar.visibility = View.INVISIBLE





                share|improve this answer













                when you want to show it

                progressBar.visibility = View.VISIBLE




                when you want to hide it

                1 progressBar.visibility = View.GONE

                2 progressBar.visibility = View.INVISIBLE






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 at 14:05









                Thavath Captain

                111




                111






























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f4717975%2fhow-to-hide-progressbar-in-android%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

                    How to change which sound is reproduced for terminal bell?

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents