可能重复:
How to display progress dialog before starting an activity in Android?
这是我的itemDetails extends Activity
课程,onOkClick
是方法。但是当我按下确定按钮,即调用方法时,不会显示ProgressDialog
。但 Toast消息正确显示。
我尝试在getApplicationContext()
方法的Context参数中使用ProgressDialog.show()
,但它无效。抱歉这个天真的问题。
public void onOkClick(View v){
ProgressDialog pleaseWait = ProgressDialog.show(itemDetails.this, "Uploading..", "Please wait for a while...", true);
//...........
HttpData httpData = HttpRequest.post("http://www.abc.com/accessServer.php", "");
//...........
pleaseWaitGallery.dismiss();
if(HttpPostTesting.storestring.contains("successful")){
Toast.makeText(getApplicationContext(), "Uploading Complete", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), "Uploading Failed!", Toast.LENGTH_LONG).show();
}
}
答案 0 :(得分:2)