Android Question Parcelable String array

Philip Prins

Active Member
Licensed User
Longtime User
Hello

I get an intent with extras:
According to the documentation it is a parcelable string array in Java,
https://developer.android.com/refer...set.html#ACTION_VENDOR_SPECIFIC_HEADSET_EVENT

B4X:
Sub BroadcastReceiver_OnReceive (Action As String, Extras As Object)
    Log(Action)
    Log(Extras)
  
    Dim ix As Intent = Extras
    If ix.HasExtra("android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_ARGS") Then
        Dim z As String = ix.GetExtra("android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_ARGS")
      
     Log(z )
    End If

Log z gives as result:[Ljava.lang.Object;@c241340

I tried z() As string and as list , both give an error.

I tried
B4X:
Dim in As JavaObject = ix
    Log(in.RunMethod("getParcelableExtra", Array("android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_ARGS")))

Result Null

I tried
B4X:
Dim in As JavaObject = ix
    Log(in.RunMethod("getParcelableExtra", Array("android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_ARGS")))
Result Null

When i log ix.extratostring:
Bundle[{android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_CMD=+XEVENT, android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE=2, android.bluetooth.device.extra.DEVICE=28:C8:25:00:04:34, android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_ARGS=[Ljava.lang.Object;@d9efec3}]

How do i convert the Ljava.lang.Object;@d9efec3 to an array or map so i can use it in B4A?
 
Last edited:
Top