I want to get the phone number who calls my application. But when I received a masked number, my application crashed. I use onCallStateChanged(). I've simplified my code for testing. It still crashed. Here's the codes(they are in an activity):

```
 public void onCreate() {
    super.onCreate();
    TelephonyManager manager = (TelephonyManager) getSystemService(Service.TELEPHONY_SERVICE);
    manager.listen(listener, PhoneStateListener.LISTEN_CALL_STATE);
 }

private PhoneStateListener listener = new PhoneStateListener(){
    @Override
    public void onCallStateChanged(int state, String incomingNumber){
        switch (state) {
        case TelephonyManager.CALL_STATE_RINGING:
            if(incomingNumber.isEmpty()){
                Log.i("PhoneStateListener incomingNumber", "void");
            }else{
                Log.i("PhoneStateListener incomingNumber", "not void");
            }
            break;
        case TelephonyManager.CALL_STATE_IDLE:
            break;
        case TelephonyManager.CALL_STATE_OFFHOOK:
            break;
        default:
            break;
        }
    }
};

```

And the errors I've got:

```
01-29 12:10:37.479: W/dalvikvm(7141): threadid=1: thread exiting with uncaught exception (group=0x41ddc700)
01-29 12:10:37.484: E/AndroidRuntime(7141): FATAL EXCEPTION: main
01-29 12:10:37.484: E/AndroidRuntime(7141): java.lang.NullPointerException
01-29 12:10:37.484: E/AndroidRuntime(7141):     at com.aif.app.MonitorCallingService$1.onCallStateChanged(MonitorCallingService.java:77)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at android.telephony.PhoneStateListener$2.handleMessage(PhoneStateListener.java:454)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at android.os.Looper.loop(Looper.java:176)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at android.app.ActivityThread.main(ActivityThread.java:5419)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at java.lang.reflect.Method.invokeNative(Native Method)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at java.lang.reflect.Method.invoke(Method.java:525)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
01-29 12:10:37.484: E/AndroidRuntime(7141):     at dalvik.system.NativeStart.main(Native Method)

```

Is it possible that there is a internal bug in the function onCallStateChanged() with a masked number?

Anyone can help me? Thanks a lot.