private void checkConnectionStatus() { if (BluetoothLeService.getConnectionState() == 0) { // Guiding the user back to profile scanning fragment Intent intent = getActivity().getIntent(); getActivity().finish(); getActivity().overridePendingTransition(R.anim.slide_left, R.anim.push_left); startActivity(intent); getActivity().overridePendingTransition(R.anim.slide_right, R.anim.push_right); } }