After a double check, i discovered that i removed the RunOnUiThread from
the loop.
The code was something like
button.Click += delegate {
button.Text = string.Format ("{0} clicks!", count++);
new Thread(() => {
TextView textView = FindViewById<TextView>(
Resource.Id.text)
for (int i = 0; i < 600; ++i) {
textView .Text = string.Format ("Updated: {0}
times", i);
}
RunOnUiThread(() => {
button.Text = "Complete";
});
}).Start ();
};
I didn't realized it before because i didn't got any "must run on ui
thread" error.
The error gone away putting the RunOnUiThread.
Thanks for your help.
2013/5/30 Jonathan Pryor <[email protected]>
> On May 30, 2013, at 11:50 AM, Daniele Salvatore Albano <[email protected]>
> wrote:
> > i'm experiencing a VERY strange bug: after a lot of tests i've founded
> the source of my problem and it appers to be a stupid line of code that i
> use to update a "clock" on the main activity.
> >
> > dateTimeTextView.Text = DateTime.Now.ToString("dddd, dd MMMM yyyy
> HH:mm").ToUpper();
> >
> > Here there is the error
> > JNI ERROR (app bug): local reference table overflow (max=512)
>
> Can you provide a reproducible test case? And the full logcat output?
>
> I'm not able to reproduce:
>
> 1. Take default template.
> 2. Edit Resources\layout\Main.axml file to add:
>
> <TextView
> android:id="@+id/text"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:text="@string/hello" />
>
> 3. Change the Click event handler to:
>
> button.Click += delegate {
> button.Text = string.Format ("{0} clicks!", count++);
>
> new Thread(() => {
> for (int i = 0; i < 600; ++i) {
> RunOnUiThread(() => {
> FindViewById<TextView>(Resource.Id.text).Text
> = string.Format ("Updated: {0} times", i);
> });
> }
> RunOnUiThread(() => {
> button.Text = "Complete";
> });
> }).Start ();
> };
>
> This should satisfy your "Update a TextView from a thread using
> RunOnUiThread()" description.
>
> The above works without any errors.
>
> Enabling lref logging may be helpful, though the lref count is known to be
> buggy (not sure why, not important enough to figure out yet, e.g. sometimes
> I see negative values...):
>
> # Note: VERY verbose; don't leave enabled for long periods of
> time...
> adb shell setprop debug.mono.log lref
>
> - Jon
>
> _______________________________________________
> Monodroid mailing list
> [email protected]
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
--
Daniele Salvatore Albano
---
IT Consultant
Website Design and Development
Software Engineer and Developer
Linux Servers SetUp And Administration
Embedded Network Solutions
http://www.daccii.it
http://www.itechcon.it
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid