-2

As I tried to Generate the Bluetooth application on how it turn on? turn off? Finally, I run the application in android studio using Emulator.Build and Sync up is Done.It doesn't show any error.While i want to open that app in emulator that it doesn't work. It shows app keep stopping.

In log cat I see that there is a Null Pointer Exception and FATAL Exception Main.

How should i solve this problem? Can any one help me out of this app clash!

Shanteshwar Inde
  • 1,438
  • 4
  • 17
  • 27
  • _"How should i solve this problem?"_ By studying the crash log and the code it points to. It gives the exact code file and even the line number. _"Can any one help me out of this app clash!"_ Not without the crash log and the relevant code. We have absolutely no idea what's going on in your app. – Markus Kauppinen Apr 05 '19 at 09:47

1 Answers1

-1

You should first check whether the device supports Bluetooth.

BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

if (bluetoothAdapter == null) {
    Toast.makeText(this, "Device does not support Bluetooth", Toast.LENGTH_SHORT).show();
    finish();
}
Akshay Kumar S
  • 333
  • 3
  • 12