小编VoW*_*VoW的帖子

Android SIP注册失败(-9 IN_PROGRESS)

这是我的注册码:

    protected void initializeManagerOpen(){
    consoleWrite("initializeOpen");
    if(mSipManager==null) {
        return;
    }
    SipProfile.Builder builder;
    try {
        builder = new SipProfile.Builder("13", "10.0.0.4");
        builder.setPassword("13");
        builder.setPort(5062);
        builder.setProtocol("UDP");
        mSipProfile = builder.build();

        try {
            Intent intent = new Intent();
            intent.setAction("android.SipDemo.INCOMING_CALL");
            PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, Intent.FILL_IN_DATA);
            mSipManager.open(mSipProfile, pendingIntent, null);

            mSipManager.setRegistrationListener(mSipProfile.getUriString(), new SipRegistrationListener() {

                public void onRegistering(String localProfileUri) {
                    mNotificationTask.endNotification();
                    mNotificationTask.createNotification(R.drawable.ic_stat_connecting,"Test","Connecting");

                    consoleWrite("Registering with SIP Server...");
                }

                public void onRegistrationDone(String localProfileUri, long expiryTime){
                    mNotificationTask.endNotification();
                    mNotificationTask.createNotification(R.drawable.ic_stat_connected,"Test","Connected");

                    consoleWrite("Ready");
                }

                public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage){
                    mNotificationTask.endNotification();
                    mNotificationTask.createNotification(R.drawable.ic_stat_disconnected,"Test","Failed to connect:"+errorCode); …
Run Code Online (Sandbox Code Playgroud)

java eclipse android sip

7
推荐指数
1
解决办法
1972
查看次数

使用(int)和(double)一起切断小数时出错

当我使用(int)和(double)一些时,它无法正常工作.
看看PHP代码示例:

我需要离开2个小数并删除其他...

我知道number_format(); 功能但我不能使用它.因为它是舍入数

number_format(24.299,2);
输出:24.30
我需要:24.29

<?php

$str="158.2";

echo (double)$str; // Output: 158.2
echo (double)$str*100; // Output: 15820
echo (int)((double)$str*100); // Output: 15819 <-WHY? It Must To Be 15820, Why 15819? 
echo ((int)((double)$str*100)/100); // Output: 158.19
?>
Run Code Online (Sandbox Code Playgroud)

我需要在数字中留下两位小数,并在不进行舍入的情况下剪切其他小数.

php floating-point double int floating-point-precision

5
推荐指数
1
解决办法
1249
查看次数