显示进度条的问题

时间:2011-05-06 04:32:53

标签: android

我想展示纺车进度,但它没有显示任何内容。

final ProgressDialog dialog = ProgressDialog.show(AppListActivity.this,
            "", "Loding...", true);
    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.dismiss();
        }
    };
    Thread checkUpdate = new Thread() {
        public void run() {

            // Set our custom array adapter as the ListView's adapter.
            listAdapter = new AppArrayAdapter(AppListActivity.this,
                    appsList);
            mainListView.setAdapter(listAdapter);

            handler.sendEmptyMessage(0);
        }
    };
    checkUpdate.start();

请弄清楚这一个.. 感谢..

3 个答案:

答案 0 :(得分:0)

你还没写过dialog.show().. 请参阅此代码

ProgressDialog UpdateDialog = new ProgressDialog(ClassContext);

        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub

            UpdateDialog.setTitle("MyApp");
            UpdateDialog.setMessage("Processing data...");
            UpdateDialog.show();
            super.onPreExecute();
        }
        @Override
        protected Object doInBackground(Object... params) {
        //your code
            }
        @Override
        protected void onPostExecute(Object result) {
            // TODO Auto-generated method stub
                //your code
                UpdateDialog.dismiss();     
            }

答案 1 :(得分:0)

 ProgressDialog mPrograss=new ProgressDialog(location.this);
            mPrograss.setTitle("loading....");
            mPrograss.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            mPrograss.setMax(1);
            mPrograss.setProgress(2000);
            mPrograss.setButton("save", new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {

                }
            });
            mPrograss.setButton2("cancel", new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                }
            });
            mPrograss.show();

答案 2 :(得分:0)

我想你可以使用下面的代码。 私人ProgressDialog pd; pd = ProgressDialog.show(上下文,“请稍候......”,“保存到数据库......”,true,false);
。 pd.dismiss();