@Override protected void onDestroy() { super.onDestroy(); if (mBle != null) { mBle.disconnect(mDeviceAddress); } }
@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); }