4

私はこのメソッドを別のクラスから持っており、呼び出しが終了すると、ImageView の色が赤から白に変わります。以下のサンプルコード:

public void endOfCall(){

    ((Activity)mContext).runOnUiThread(new Runnable(){
        @Override
        public void run(){
            TargetDetails.oncall.setVisibility(View.VISIBLE);
            TargetDetails.endcall.setVisibility(View.GONE);
        }
    });

    try{
        call.endCall();
    }catch (SipException se) {}

    call.close();

    //this is just a representation; not the actual code
    if(true){
      Thread.sleep(10000);
    }

    //new intent here
}

問題は、Thread.sleep を配置した「if」条件になったときに始まります。以下のコードが実行されるまで 10 秒待機します。

TargetDetails.oncall.setVisibility(View.VISIBLE);
TargetDetails.endcall.setVisibility(View.GONE);

Thread.sleep に関して、ここで何かが欠けていると思います。私はそれを取り除きたいだけですが、それ以外の選択肢がわかりません。ヘルプ。ありがとう。

4

1 に答える 1