Michael,

I had responded to you on this through the support e-mail but here's my
message incase you missed it and for everyone else to see too,

This has been rather tricky but you can convert a Object to a Object[] by
using the following lines:

var pdus = bundle.Get ("pdus");
Java.Lang.Object[] castedPdus =
JNIEnv.GetArray<Java.Lang.Object>(pdus.Handle);

This solves one half of the problem, when you have your casted PDUs, you
still need to convert those objects into a byte array, and you would do this
like the following;

var bytes = new Byte[JNIEnv.GetArrayLength(castedPdus[i].Handle)];
JNIEnv.CopyArray(castedPdus[i].Handle, bytes);

So the final example will look something like this;
https://gist.github.com/cc8eec0c5b35fffc05cb

I hope this helps! This was quite something to figure out!

Chris Hardy

On Mon, Oct 17, 2011 at 8:19 PM, Sayed Arian Kooshesh <koosh...@gmail.com>wrote:

> this is actually a really common error i've experienced in things
> other than this project.
>
> Try ObjectDumper  it might help you continue past this.
>
> On Mon, Oct 17, 2011 at 2:15 PM, mcgear <michael.gearha...@zed.com> wrote:
> > That is correct, however this should be returning an array...  As you can
> see
> > from this QuickWatch output:
> > -        Class  {class [Ljava.lang.Object;}     Java.Lang.Class
> > +        base   {Java.Lang.Object}      Java.Lang.Object
> >                CanonicalName   "java.lang.Object[]"    string
> > +        ClassLoader    {java.lang.BootClassLoader@4001bde0}
> > Java.Lang.ClassLoaderInvoker
> > +        ComponentType  {class java.lang.Object}        Java.Lang.Class
> > +        DeclaringClass (null)  object
> > +        EnclosingClass (null)  object
> >
> > The CanonicalName states that this is a java.lang.Object[]
> >
> > And if you look at an article
> > (http://www.apriorit.com/our-company/dev-blog/227-handle-sms-on-android)
> > you'll see that the Android API is in fact supposed to return an object[]
> > for the "PDUS"...
> >
> > Any additional help would be great!
> >
> > --
> > View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/SMS-Message-Receiver-tp4903060p4911172.html
> > Sent from the Mono for Android mailing list archive at Nabble.com.
> > _______________________________________________
> > Monodroid mailing list
> > Monodroid@lists.ximian.com
> >
> > UNSUBSCRIBE INFORMATION:
> > http://lists.ximian.com/mailman/listinfo/monodroid
> >
>
>
>
> --
> Extreme Knowledge is not something for which he programs a computer
> but for which his computer is programming him.
>
> -Wozniak
> _______________________________________________
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>



-- 
ChrisNTR
Microsoft ASPInsider
http://weblogs.asp.net/chrishardy
http://twitter.com/chrisntr
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to