开发者

Problems showing a ProgressDialog from a onClick method

i am trying to make a progressdialog inside a onclick, and it doesn't shows nothing

this is my 开发者_开发百科code:

enterButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
ProgressDialog pd = ProgressDialog.show(GPSLoc.this, GPSLoc.this.getResources().getString(R.string.app_name), 
                                    GPSLoc.this.getResources().getString(R.string.loading), true, false);  
}}

why it doesn't shows nothing? i am doing something wrong?


I think your issue is that your are just creating the Progressdialog not actually showing it. Try adding pd.show(); to the the onclick method after you initialize the ProgressDialog.


finally i did it implementing that with an AsyncTask. Because AsyncTask manages the UIThread and a background thread.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜