I want to create an application based on bluetooth operation in android.I am using the following code
BluetoothAdapter adapter=BluetoothAdapter.getDefaultAd
You can but you will need to run your app on an Android inside a VirtualBox or VMWare image. For more infos, see here (tutorial is for Bluetooth LE, but it works just the same with other Bluetooth versions): Bluetooth Low Energy on Android Emulator