我在我的android應用程序中創建了一個ProgressDialog。但是我遇到的問題是,在實際上停止旋轉車輪的過程中。這是我的代碼。我如何做到這一點,以便在我的其他工作正在進行時不斷旋轉車輪?Android ProgressDialog停止旋轉
button5.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
System.out.println("Button5");
//Handler to make the please wait message
final ProgressDialog myProgressDialog = ProgressDialog.show(
FoodSubstitutesActivity.this, "Please wait...",
"Getting most recent updates...", true);
Handler handler = new Handler();
handler.postDelayed(new Runnable()
{
@Override
public void run()
{
//DO STUFF - STOPS SPINNING WHEEL UNTIL THIS PART IS COMPLETE.
myProgressDialog.dismiss();
}
}, 500);
}
});
您阻塞UI線程 – slezica 2012-03-09 04:32:57