开发者

How to show Progress control or gif in android?

When I call webservice on clicking button, it waits to load records on new activity and shows activity blank during that time period.

Can any one guide me how to sh开发者_如何学JAVAow progress during that time period?


You could display a progress view on your activity:

public class MyActivity extends Activity {
     private static final int PROGRESS = 0x1;

     private ProgressBar mProgress;

     private Handler mHandler = new Handler();

     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);

         setContentView(R.layout.progressbar_activity);

         mProgress = (ProgressBar) findViewById(R.id.progress_bar);
         mProgress.setIndeterminate(true);
         mProgress.setVisibility(true);

         // Start lengthy operation in a background thread
         new Thread(new Runnable() {
             public void run() {
                 doWork();
                 mProgress.setVisibility(false);
             }
         }).start();
     }
 }

See ProgressBar documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜