我从一个单独的类中获得了这个方法,其中当调用结束时,我的 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 的东西。我只是想摆脱它,但我不确定除此之外的任何其他选择。帮助。谢谢。