oncallevents在android的两个对等机的套接字中不工作

b5lpy0ml  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(147)

您好,在下面的代码中,我是为套接字实现callevents的,但它不工作。当我尝试按end call按钮时,它会给我一个空指针异常。
谁能帮我解决这个问题。
oncallevents.java:

public interface OnCallEvents {
    void onCallHangUp();

    void onCameraSwitch();

    void onCaptureFormatChange(int width, int height, int framerate);

    boolean onToggleMic();
}

videocallfragment.java:

public class VideocallFragment extends Fragment implements OnCallEvents {
 public VideocallFragment() {

    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.video_main, container, false);
        surfaceView=rootView.findViewById(R.id.surfaceView);
        surfaceView2=rootView.findViewById(R.id.surfaceView2);
        button_call_disconnect=rootView.findViewById(R.id.button_call_disconnect);
button_call_disconnect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onCallHangUp();
                Toast.makeText(getContext(),"Call Disconnected",Toast.LENGTH_LONG).show();

            }
        });
 @Override
    public void onCallHangUp() {
        socket.disconnect();
    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题