I think that this turned out to be an incorrect (?) use of the "using"
statement.....

What I was doing was (pseudo code):

AbsoluteLayout al = new AbsoluteLayout(this);

using (RotatingTextView rtv = new RotatingTextView())
{
        rtv.somenewproperty = somevalue;
        al.AddView(rtv);
}

SetContentView(al);

I don't fully understand how the whole .Net <-> Java VM stuff works, but
I guess that the GC destroyed the rtv Object even though the Java
"version" of it still existed as it was added to the Layout?  Then when
the Layout gets used in SetContentView , the Java version of the rtv
Object is re-instantiated as a new instance of RotatingTextView  since
the original one was GC'd and can't be found...... and the new instance
has the default 0 values....

I removed the "using" statement and it all started working as it should.

I guess I am not using the "using" statements correctly throughout my
code as I do a lot of the above, but it *seems* to work most of the
time.


Unless you think that this is still a bug, I won't file a bug report!!


Thanks,

Martyn 



-----Original Message-----
From: monodroid-boun...@lists.ximian.com
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: 14 September 2011 20:53
To: Discussions related to Mono for Android
Subject: Re: [mono-android] Extending TextView

On Sep 13, 2011, at 6:32 AM, Martyn Wendon wrote:
> I'm probably doing something silly, but I can't seem to get the
following code to work.

Could you please file a bug and attach a full sample (something I can
easily build)?

Thanks,
 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

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

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
______________________________________________________________________
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

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

Reply via email to