- 博客(0)
- 资源 (1)
- 收藏
- 关注
btjax蓝牙控制软件源码
自己做的蓝牙小车上位机软件,适合新手参考
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);//设置显示模式无顶部
setContentView(R.layout.button);
text_show=(TextView)findViewById(R.id.text_show);
edit_0=(EditText)findViewById(R.id.edit_0);
Button button_send=(Button)findViewById(R.id.button_send);
button_send.setOnClickListener(this);
Button button_0=(Button)findViewById(R.id.button_0);
button_0.setOnClickListener(this);
Button button_1=(Button)findViewById(R.id.button_1);
button_1.setOnClickListener(this);
Button button_2=(Button)findViewById(R.id.button_2);
button_2.setOnClickListener(this);
Button button_3=(Button)findViewById(R.id.button_3);
button_3.setOnClickListener(this);
Button button_4=(Button)findViewById(R.id.button_4);
button_4.setOnClickListener(this);
button_connected=(Button)findViewById(R.id.button_connect);//后面他的响应事件会用到
if(mBluetoothAdapter==null){
Toast.makeText(this, "请确认当前设备有蓝牙功能!", Toast.LENGTH_SHORT).show();
finish();
return;
}
//在子线程里开启蓝牙
new Thread(){
@Override
public void run() {
// TODO Auto-generated method stub
super.run();
if(!mBluetoothAdapter.isEnabled()){
Intent intentBluetooth_start=new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivity(intentBluetooth_start);
}
}
}.start();
2018-01-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人