i found a correct solution :)

the first time he go to listview, he haven't the pics.. ok so pics have a SetImageResource, and separate thread download the pics, and replace the pics. At this time, there is a minimum of 100 ms to download.. to cache the pic.. and change the pic.

The second time he return to the listview, pic is in cache, so i do a SetImageDrawable.

I understand android (in 2.1 i don't know later versions), hate have changed lot of things at the same time, whether with the object image directly, or with a FindViewById...

Le 27/03/2012 20:00, Miha Markic a écrit :
It is not clear from your description but here is my guess:
You know that you can touch UI elements only from within UI thread?
Try with RunOnUiThread method.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of michelw
Sent: Tuesday, March 27, 2012 2:30 PM
To: Discussions related to Mono for Android
Subject: [mono-android] multithread on a listview

Hello.

I've a listview with pics, and unique id for each pic.

I've a separate thread who change the pics.

If this thread change one pic per pic, no problem.

If this thread launch a separate thread to change the pic, and if i do a
thread.sleep(100) before launch each  separate thread, no problem...

If i remove my sleep, or if i put a sleep<  100 ms, problems, he write to the 
UI some pics at bad place (some pics, not all pics)

I try doing a lock on the setbackgroundimage with a global Object lock for see 
but i've the same problem, i must do a sleep before each thread!

So my question, it's is possible, to change more than one pic at the same time 
(or in a very very short time), on android...

or.. if it's not possible... is there a method to know where android have 
finish to set the pic to an item ImageView

Android 2.1, on avd
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
[email protected]

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

Reply via email to