public void onStart() { super.onStart(); btadapter = BluetoothAdapter.getDefaultAdapter(); if (btadapter == null) { /* uh-oh.. no bluetooth module found! */ Toast.makeText(this, "Sorry, no bluetooth module found!", Toast.LENGTH_SHORT); /* terminate the activity */ finish(); } else { if (!btadapter.isEnabled()) { startActivityForResult( new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), REQUEST_BLUETOOTH_ENABLE); } else { setup(); } } }