BluetoothAdapter.getDefaultAdapter() returns null in the android simulator, so calling BluetoothAdapter.getDefaultAdapter().getName() throws an exception.
On initialisation this checks whether BluetoothAdapter.getDefaultAdapter() isn't null and only then tries to run getName()
BluetoothAdapter.getDefaultAdapter()
returns null in the android simulator, so callingBluetoothAdapter.getDefaultAdapter().getName()
throws an exception.On initialisation this checks whether
BluetoothAdapter.getDefaultAdapter()
isn't null and only then tries to rungetName()