Sunday, July 03, 2016

How to add progress bar in android

1- In activity class use below code

ProgressDialog loading = null;
Inside onCreate method:-
loading = new ProgressDialog(ProjectPageActivity.this);
        loading.setMessage("Please wait...");
        loading.setCancelable(false);
        loading.setIndeterminate(true);
        loading.setProgressStyle(ProgressDialog.STYLE_SPINNER);

2- Use below code to show the progress graph

            loading.show();

3- Use below code to hide it
loading.dismiss();

No comments: