Recent Posts

Site Creator

By

By

By

Adding a Progress while making a GET Request

Posted on

Dear Friends

As we have already made   Http Get Request Example Link

We will expand it and try to show a circular progress bar while making network request. So to start with we will add a progress bar in xml layout.

we will  play with the visibility attribute of progress bar element at right place in our code.

Please have a closer look at Asynctask .

 

 

There a few callbacks methods called whenever a request  to execute asynctask is made.

After the constructor of Asynctask is called its onPreExecute method that gets called. Now in onPreExecute you can modify visibility of UI Element ( ProgressBar). So in UI you will see a progress loader on screen. Now doInBackground callback will be called and we actually hit http url to get our data. Once we get the data in onPostExecute we again make visibility of ProgressBar as gone.

 

This is just an example how progressbar is used.  We can definitely used it in more complex ways.

 

 

 

 

 

 

 

 

 

 

 

 

 







Disclaimer: The aforesaid writeup by Relsell Global writer is for the general understanding of the readers. It does not render any professional advice or opinion.

SHARE THIS PAGE!