如何在列表视图中显示进度对话框

时间:2014-09-05 16:32:54

标签: android listview progressdialog

我有一个ListView,在我想要的填充方法中,当我点击每个项目进度对话框显示(用于加载)

这是我的填充方法

public void fill(final ArrayAdapter<RssParser.Item> adapter, final RssParser.Item item, final int position)
{  
      Thread thread = new Thread(new Runnable() {

            @Override
            public void run() {

                ActivityStartup.handler.post(new Runnable() {

                    @Override
                    public void run() {
                        ActivityStartup.dismissLoadingDialog();
                        txtTitle.setText(item.title);
                        txtDate.setText(item.pubDate);
                        txt_time.setText(item.time);
                        txtDescription.setText(item.description);
                        layoutRoot.setOnClickListener(new OnClickListener() {

                            @Override
                            public void onClick(View v) {

                                 **//\\  here I want to display Progress Dialog //\\**

                                Intent intent = new Intent(G.context, Adapter_Description.class)
                                        .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                intent.putExtra("INPUT", item.link + "");
                                intent.putExtra("INPUT_DESC", item.description + "");
                                G.context.startActivity(intent);
                            }
                        });

                    }
                });

            }
        });
        thread.start();

我写了这个,但它在“new ProgressDialog(this);”上有错误 并且错误说:  构造函数ProgressDialog(new View.OnClickListener(){})未定义

if (progress == null) {
progress = new ProgressDialog(this);
progress.setTitle("title");
progress.setMessage("loading");
}
progress.show();

0 个答案:

没有答案