コード例 #1
1
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mBle != null) {
     mBle.disconnect(mDeviceAddress);
   }
 }
コード例 #2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_connect:
       mBle.requestConnect(mDeviceAddress);
       return true;
     case R.id.menu_disconnect:
       mBle.disconnect(mDeviceAddress);
       onDeviceDisconnected();
       return true;
     case android.R.id.home:
       onBackPressed();
       return true;
   }
   return super.onOptionsItemSelected(item);
 }