Search code examples
androidandroid-bluetooth

Why do we use "intent.getParcelable()" on "BluetoothDevice.EXTRA_DEVICE"?


I am learning about bluetooth in android.

I am wondering why do we use intent.getParcelable() on BluetoothDevice.EXTRA_DEVICE when its return type is string?

Why don't we use intent.getStringExtra?


Solution

  • it isn't returning String, its BluetoothDevice (which implements Parcleable)

    BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);