views:

258

answers:

1

dear friends,

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 show progress during that time period?

any help would be appriciated.

+1  A: 

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 this section of the Android documentation:

http://developer.android.com/intl/de/reference/android/widget/ProgressBar.html

seanhodges