如何在Android中调用时给出时间延迟?

时间:2013-08-12 09:36:26

标签: java android

我正在从事会议经理申请。当用户单击特定配置文件时,将调用dialConference函数。

 private void dialConference()

  {

    String str = "tel:";

    int i = 0;

    if (i >= this.confProfile.arrayValue.size())
    {
      startActivity(new Intent("android.intent.action.CALL", Uri.parse(str)));
      return;
    }
    ProfileDataValue localProfileDataValue = (ProfileDataValue)this.confProfile.arrayValue.get(i);
    if (i != 0)
    {
      if (localProfileDataValue.iDelay / 2 != 0)

        break label128;

      str = str + "%2C";
    }
    while (true)
    {
      localProfileDataValue.strValue = localProfileDataValue.strValue.replace("#", "%23");
      str = str + localProfileDataValue.strValue;
      i++;
      break;
      label128: int j = localProfileDataValue.iDelay / 2;
      for (int k = 0; k < j; k++)
        str = str + "%2C";
    }
  }

1 个答案:

答案 0 :(得分:1)

此方法正常工作,可以在通话期间给出时间延迟并执行下一个号码。

private void call(int profileid){

            ProfileDo profile = adapter.getProfile(profileid);

            String call = "tel:";

            for (StepDO step : profile.getSteps()) {

                String value = URLEncoder.encode(step.getValue());

                int delay = step.getDelay();

                String pausesStr = "";

                for (int i = 0; i < delay/2; i++) {

                    pausesStr += PhoneNumberUtils.PAUSE;
                }
                call += value + pausesStr;


                System.out.println(""+call);
            }
            Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(call));

            startActivity(callIntent);
        }
    }