Hi,
I am creating a custom view to represent some kind of photo-collage.
Here's how I have intended to do / achieve...
(1) Create a custom "ViewGroup" that will comprise of only and only
ImageView views with pseudo-random size and rotation.
(2) Since images will be fetched on the fly from the server and I do
not intend to use more than a few simultaneous threads to fetch the
data from the server, I am using "Handler" to receive any responses
(3) All UI update is being done in onLayout
3a. For the first time, I add required ImageView instances (since
I know the number of images)
3b. All the image-view's show a "loading" image
3c. When the response is available from server, the Handler
handles the message and sets the "ImageBitmap" to the one obtained and
decoded from the server -- whenever an image download is complete, I
call "requestLayout" to ensure that onLayout is called
3d. Each image is encapsulated in a class with two pieces of
information - state (Loading/Loaded) and image (Bitmap)
Problem:
I see that as and when the responses are available, the onLayout is
called that sets the appropriate images to the UI.
However, I do not see "loading..." images being shown up. It seems
that the UI thread is blocked and the UI update really does not happen
immediately when the image-bitmap is set.
Questions:
1. What am I doing wrong... I think that I should not call
requestLayout multiple times but only setImageBitmap when the response
is available. Tried that too... but of no use :(
2. What's the suggested approach to implement this kind of a UI...
Thanks in advance.
Happy Hacking,
Gaurav Vaish
www.mastergaurav.com
--------------------------------------
--
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