ここでは、私のアプリケーションのアップデートがユーザーのために利用可能であるというcheckupdate()の機能を持っているので、サーバーがリクエストを受けているときに2つのprogressdialogを表示する必要があり(プロセスのチェック中)、同期プロセスが進行中で、アプリケーションの負荷で実行されます。 ここでは2つの進捗ダイアログボックスを表示できません。ここでは最初のスレッドチェックの更新が実行され、アプリケーションが終了します。 貴重な回答を待っています。1つの関数で2つのスレッドを使用するには?
public void CheckUpdate()
{
//----------------Process of checking the updates--------------------------
try
{
progressDialog = ProgressDialog.show(this, "Wait", "Checking update...", false, true);
Thread thr1 = new Thread()
{
public void run()
{
int Flag = call.CheckUserUpdate(UsrId);
Update = Flag;
progressDialog.dismiss();
//stop();
interrupt();
}
};
thr1.start();
}
catch(final Exception e)
{
}
//---------------Process of Synchronization----------------------------------------------
try
{
progressDialog1 = ProgressDialog.show(this, "Wait", "Synchronizing...", false, true);
Thread thr2 = new Thread()
{
public void run()
{
if(Update == 1)
{
SyncData();
final int UpdateFlag = 1;
call.UpdateUserUpdate(UsrId, UpdateFlag);
progressDialog1.dismiss();
}
else
{
progressDialog1.dismiss();
}
progressDialog1.dismiss();
}
};
thr2.start();
}
catch(final Exception e)
{
}
}