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();
2.7MB
文件大小:
评论区