0
可能重複:
How to display progress dialog before starting an activity in Android?一個HttpRequest期間顯示ProgressDialog
這是我itemDetails extends Activity
類onOkClick
是方法。但是當我按下確定按鈕,即調用方法沒有ProgressDialog
顯示。但吐司消息顯示正確。
我在ProgressDialog.show()
方法的Context參數中嘗試使用getApplicationContext()
,但它不起作用。對不起,這個天真的問題。
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();
}
}