Hi,
You can try concatenating the foo's into a single string delimited by
some character that will NOT appear in any of the strings. For
example, I am assuming pipe character (|) will never appear in any of
the strings you want to pass.
Then, create a string like:

"7|Hello|This is another string|1123|"
Put this string as extra. In the receiving part, tokenize the string
by |, then you get all the elements.

Regards
Sarwar Erfan


On Aug 4, 2:02 am, 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