2013-09-26 3 views
0

После вызова sipmanger.open внутри расширяющегося потока класса. Я проверил, были ли какие-либо параметры пустыми, а они нет.Исключение Null Pointer при вызове SetRegistrationListener

Любые идеи?

private void setlisten() throws SipException { 
    sipman.setRegistrationListener(sipprofile.getUriString(), new SipRegistrationListener() { 

     public void onRegistering(String localProfileUri) { 
      Message msg = Message.obtain(); 
      msg.what = 10; 
     } 

     public void onRegistrationDone(String localProfileUri, long expiryTime) { 
      Message msg = Message.obtain(); 
      msg.what = 93; 

      Log.d("register", "register done"); 
     } 

     public void onRegistrationFailed(String localProfileUri, int errorCode,String errorMessage) { 
     }  
    }); 
} 

Стек след в залежах:

f09-26 16:24:03.457: E/AndroidRuntime(11692): FATAL EXCEPTION: Thread-11 
09-26 16:24:03.457: E/AndroidRuntime(11692): java.lang.NullPointerException 
09-26 16:24:03.457: E/AndroidRuntime(11692): at com.example.project2.sipwork.setlisten(sipwork.java:153) 
09-26 16:24:03.457: E/AndroidRuntime(11692): at com.example.project2.sipwork.run(sipwork.java:193) 

Line 153:

sipman.setRegistrationListener(sipprofile.getUriString(), new SipRegistrationListener() {

Line 193:

setlisten();

private SipProfile buildsip(JSONObject sipcreds) throws JSONException, ParseException{ 

    SIP_USER = sipcreds.getString("username"); 
    SIP_PASSWORD = sipcreds.getString("password"); 

    if (sipman == null){ 
     sipman = SipManager.newInstance(context); 
    } 

    SipProfile.Builder builder = new SipProfile.Builder(SIP_USER, SIP_DOMAIN); 
    builder.setPassword(SIP_PASSWORD); 
    builder.setAuthUserName(sipcreds.getString("username")); 
    builder.setAutoRegistration(true); 
    builder.setOutboundProxy(SIP_DOMAIN); 

    SipProfile mSipProfile = builder.build(); 

    if (mSipProfile == null) { 
     Log.d("problem", "that seems to be the problem"); 
    } 


    return mSipProfile; 
} 


private void sipint(SipProfile sipprofile) throws SipException{ 

    Intent intent = new Intent(); 
    intent.setAction("android.example.project2.INCOMING_CALL"); 
    PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, Intent.FILL_IN_DATA); 
    sipman.open(sipprofile, pendingIntent,null); 

    if (sipman == null){ 
     Log.d("problem", "found the null"); 
    } 

SipProfile sipprofile = buildsip(sipcreds); 

     sipint(sipprofile); 
     setlisten();   
+0

Можете ли вы разместить логарифм, потому что что-то * есть '' null, если вы получаете 'NPE'? – codeMagic

+0

Можете ли вы добавить stacktrace в NullPointerException? – icyitscold

+0

Что находится в строке 153? – codeMagic

ответ

0

Двойная проверка, что переменные sipman и sipprofile не являются null.

+0

Done они не – user155813

+0

Ммм, пожалуйста, делитесь LogCat и линия, которая бросает исключение – ssantos

+0

отредактирован, чтобы показать, что – user155813

Смежные вопросы