ringa_lee2017-04-17 13:17:41
Generally speaking, network operations are placed in asynchronous threads and can be implemented by inheriting the AsyncTask class.
- Place network operations in the doInBackground method of this class
- Before calling the network operation, the onPreExecute method inside will be called, and the progress bar can be displayed here
- After performing the network operation, the onPostExecute method of this class will be called, and the progress bar will be hidden here.
PHP中文网2017-04-17 13:17:41
First of all, I agree with the method above. Let me provide the second method:
It can also be achieved using handler, but the premise is that you must be able to customize the dialog control. You only need to display the dialog control before the network task execution starts. , after completion, just dismiss and adjust the dialog in the handleMessage() method.