切换android活动时的致命信号6(SIGABRT)

时间:2015-03-19 14:09:53

标签: android android-activity sigabrt pjsip

我正在尝试从PJSIP-Calls的监听器中切换活动, 但是收到此错误:Fatal signal 6 (SIGABRT), code -6 in tid 8613 (Thread-23469)

我的听众代码:

    public void onIncomingCall(OnIncomingCallParam iprm){
        Log.e("SIP_Account", "Receiving Call" );
        SIP_Controler sip_controler = SIP_Controler.getInstance();
        SIP_Call call = new SIP_Call(sip_controler.getSIPAccount(), sip_controler.getEndpoint());

        if(sip_controler.hasActiveCall() ){
            //If there is an active call, decline the incomming call and send busy signal
            CallOpParam callOpParam = new CallOpParam();
            callOpParam.setStatusCode(pjsip_status_code.PJSIP_SC_DECLINE);
            try {
                call.hangup(callOpParam);

            } catch (Exception e) {
                Log.e("SIP_Account", "Error while hanging up the incomming call " + e.toString());
            }
        }else{
            Log.e("SIP_Account", "Try to change activity:" );
            MiscFunctions.getCurrentForegroundActivity().changeActivity(VoIPViewCommands.RECEIVECALL, ActivityVoIPCall.class);
        }
    }

在MiscFunctions中,我得到了一个代码,允许我访问当前位于前台的Activity:

public class MiscFunctions {

static private TelephoneActivity currentForegroundActivity;


static public TelephoneActivity getCurrentForegroundActivity(){
    return  currentForegroundActivity;
}

static public void setCurrentForegroundActivity(TelephoneActivity ta){
    currentForegroundActivity = ta;
}
...

而TelephoneActivity是SherlockFragmentActivity的延伸。

    /***************************************************************************************************
     * All activities in this project should extend this activity. This one will make sure that you can
     * always get the activity that is currently in the foreground of your app.
     *
     **************************************************************************************************/
    public class TelephoneActivity extends SherlockFragmentActivity {

        public void onResume(){
            super.onResume();
            MiscFunctions.setCurrentForegroundActivity(this);
        }

        public void changeActivity(VoIPViewCommands extra, Class activityClass){
            Intent i = new Intent(getApplicationContext() , activityClass);
            Log.e("TelephoneActivity", "Change the activity" );
            i.putExtra("Command", extra);
            getApplicationContext().startActivity(i); //this is the line that leads to a crash 
//with 'Fatal signal 6 (SIGABRT), code -6 in tid 8613 (Thread-23469)' message.
        }

    } 

有谁可以向我解释这里有什么问题?

1 个答案:

答案 0 :(得分:1)

您收到的信号是“中止”信号,请查看this以获取可能的信号列表。

我猜您的问题在于 getApplicationContext() .startActivity(i);这里。只需在这里写startActivity(i)就可以了。

另请注意有关getApplicationContext的Android文档的this part

  

返回单个全局Application对象的上下文   目前的过程。这通常只应在需要的时候使用   生命周期与当前上下文分离的上下文,即   与过程的生命周期相关,而不是当前的组件。