Buggy code:
public class VideoCallActivity extends CallActivity implements OnClickListener { private SurfaceView localSurface ; private SurfaceHolder localSurfaceHolder ; private static SurfaceView oppositeSurface ; private SurfaceHolder oppositeSurfaceHolder ; private boolean isMuteState ; private boolean isHandsfreeState ; private boolean isAnswered ; private int streamID ; private boolean endCallTriggerByMe = false ; EMVideoCallHelper callHelper ; private TextView callStateTextView ; private Handler handler = new Handler ( ) ; private LinearLayout comingBtnContainer ; private Button refuseBtn ; private Button answerBtn ; private Button hangupBtn ; private ImageView muteImage ; private ImageView handsFreeImage ; private TextView nickTextView ; private Chronometer chronometer ; private LinearLayout voiceContronlLayout ; private RelativeLayout rootContainer ; private RelativeLayout btnsContainer ; private CameraHelper cameraHelper ; private LinearLayout topContainer ; private LinearLayout bottomContainer ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } class localCallback implements SurfaceHolder . Callback { @ Override public void surfaceCreated ( SurfaceHolder holder ) { } @ Override public void surfaceChanged ( SurfaceHolder holder , int format , int width , int height ) { } @ Override public void surfaceDestroyed ( SurfaceHolder holder ) { } } class oppositeCallback implements SurfaceHolder . Callback { @ Override public void surfaceCreated ( SurfaceHolder holder ) { } @ Override public void surfaceChanged ( SurfaceHolder holder , int format , int width , int height ) { } @ Override public void surfaceDestroyed ( SurfaceHolder holder ) { } } void addCallStateListener ( ) { } @ Override public void onClick ( View v ) { switch ( v . getId ( ) ) { case id . btn_refuse_call : refuseBtn . setEnabled ( false ) ; if ( ( ringtone ) != null ) ringtone . stop ( ) ; try { EMChatManager . getInstance ( ) . rejectCall ( ) ; } catch ( Exception e1 ) { e1 . printStackTrace ( ) ; saveCallRecord ( 1 ) ; finish ( ) ; } callingState = CallingState . REFUESD ; break ; case id . btn_answer_call : answerBtn . setEnabled ( false ) ; if ( ( ringtone ) != null ) ringtone . stop ( ) ; if ( isInComingCall ) { try { callStateTextView . setText ( "正在接听..." ) ; EMChatManager . getInstance ( ) . answerCall ( ) ; cameraHelper . setStartFlag ( true ) ; openSpeakerOn ( ) ; handsFreeImage . setImageResource ( icon_speaker_on ) ; isAnswered = true ; isHandsfreeState = true ; } catch ( Exception e ) { e . printStackTrace ( ) ; saveCallRecord ( 1 ) ; finish ( ) ; return ; } } comingBtnContainer . setVisibility ( INVISIBLE ) ; hangupBtn . setVisibility ( VISIBLE ) ; voiceContronlLayout . setVisibility ( VISIBLE ) ; localSurface . setVisibility ( VISIBLE ) ; break ; case id . btn_hangup_call : hangupBtn . setEnabled ( false ) ; if ( ( soundPool ) != null ) soundPool . stop ( streamID ) ; chronometer . stop ( ) ; endCallTriggerByMe = true ; <START_BUG> callStateTextView . setText ( "正在挂断..." ) ; <END_BUG> try { EMChatManager . getInstance ( ) . endCall ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; saveCallRecord ( 1 ) ; finish ( ) ; } break ; case id . iv_mute : if ( isMuteState ) { muteImage . setImageResource ( icon_mute_normal ) ; audioManager . setMicrophoneMute ( false ) ; isMuteState = false ; } else { muteImage . setImageResource ( icon_mute_on ) ; audioManager . setMicrophoneMute ( true ) ; isMuteState = true ; } break ; case id . iv_handsfree : if ( isHandsfreeState ) { handsFreeImage . setImageResource ( icon_speaker_normal ) ; closeSpeakerOn ( ) ; isHandsfreeState = false ; } else { handsFreeImage . setImageResource ( icon_speaker_on ) ; openSpeakerOn ( ) ; isHandsfreeState = true ; } break ; case id . root_layout : if ( ( callingState ) == ( CallingState . NORMAL ) ) { if ( ( bottomContainer . getVisibility ( ) ) == ( View . VISIBLE ) ) { bottomContainer . setVisibility ( GONE ) ; topContainer . setVisibility ( GONE ) ; } else { bottomContainer . setVisibility ( VISIBLE ) ; topContainer . setVisibility ( VISIBLE ) ; } } break ; default : break ; } } @ Override protected void onDestroy ( ) { } @ Override public void onBackPressed ( ) { } }

Fix:
callStateTextView . setText ( getResources ( ) . getString ( hanging_up ) ) ;