---
title: "调用progressbar 的方法："
author: "liangoogle"
date: "2011-06-27T13:55:13Z"
tags: []
categories: ["移动开发"]
slug: "progressbar"
draft: false
lastmod: "2011-06-27T13:55:13Z"
id: 1106322
url: "https://liangoogle.iteye.com/blog/1106322"
---

使用和取消时调用下面的两个方法

   private ProgressDialog pBar;

   private void showWaitingDialog() {

        pBar = new ProgressDialog(this);

        pBar.setTitle("Title");

        pBar.setMessage("请稍等...");

        pBar.setProgressStyle(ProgressDialog.STYLE\_SPINNER);

        pBar.show();

    }

    private void cancelDialog() {

        if (pBar != null && pBar.isShowing()) {

            pBar.cancel();

            pBar = null;

        }