蓝牙连接已终止

时间:2018-10-22 06:46:30

标签: android bluetooth

我有一些问题,因为蓝牙。 当我单击按钮时,将显示“设备选择”窗口,然后选择设备。然后如果我再单击一次,它将显示摄像头凸轮,但我无法正常工作。

enter image description here

我看不到视频。
请帮助我

这是我的设置

package com.newtc.pk.bluetoothcamera;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
import android.widget.LinearLayout;

public class SettingDialog extends AppCompatActivity {
    public static final String TAP_PREFERENCES = "tap_preferences";
    public static final String KEY_DEVICE_IP = "key_device_ip";
    public static final String KEY_DEVICE_PORT = "key_device_port";
    public static final String KEY_CONNECT = "key_connect";
    public static final String DEFAULT_IP = "192.168.1.14";
    public static final int DEFAULT_PORT = 5000;

    public SharedPreferences preferences;

    private EditText editTcpIp;
    private EditText editPort;

    private LinearLayout connect_edit_layout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.setting_dialog);
        editTcpIp = (EditText) findViewById(R.id.edit_tcp_ip);
        editPort = (EditText) findViewById(R.id.edit_port);

        connect_edit_layout = (LinearLayout) findViewById(R.id.connect_edit_layout);

        preferences = getSharedPreferences(TAP_PREFERENCES, 0);
        if (preferences != null) {
            editTcpIp.setText(preferences.getString(KEY_DEVICE_IP, DEFAULT_IP));
            editPort.setText(Integer.toString(preferences.getInt(KEY_DEVICE_PORT, DEFAULT_PORT)));
        }

    }

    public void onClickOk(View v) {
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(KEY_DEVICE_IP, editTcpIp.getText().toString());
        editor.putInt(KEY_DEVICE_PORT, Integer.parseInt(editPort.getText().toString()));
        editor.commit();
        Intent _intent = getIntent();
        _intent.putExtra("OK", "Y");
        setResult(RESULT_OK, _intent);
        finish();
    }

    public void onClickCancle(View v) {
        Intent _intent = getIntent();
        _intent.putExtra("OK", "N");
        setResult(RESULT_OK, _intent);
        finish();
    }
}

0 个答案:

没有答案