Another option would be to convert the data to JSON.  Fairly general
for integers and strings.

On Aug 3, 3:02 pm, Herb Jellinek <[email protected]> wrote:
> I have a program that sends a broadcast Intent that needs an "extra"
> value.  The value is declared as being of type Object[], though I know
> that the elements are always of type Integer or String.  That's part
> of an API not under my control.
>
> What's the most concise and/or efficient way to do the equivalent of
> the putExtra call below?  I am willing to convert foo to another data
> type for the putExrta and convert back in the receiver(s).
>
>     Object[] foo = new Object[FOO_SIZE];
>     ...
>     foo[0] = new Integer(7);
>     ...
>     foo[6] = "Hello";
>
>     Intent broadcastIntent = new Intent(MY_INTENT);
>     // assert: all elements of foo are Integer or String
>     broadcastIntent.putExtra(MY_EXTRA, foo); // XXX not correct
>
> Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to