Is there an "OnLayoutDoneLoading" method I can ove

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Is there an "OnLayoutDoneLoading" method I can ove

Postby ErnestoGuevara » Tue Jan 20, 2009 1:03 am

My app's main screen has a layout that uses two main layout pieces. There's an AbsoluteLayout (for buttons and background images) and a class that overrides SurfaceView, which handles custom animation stuff. (The animations are calculated based on application state, so I can't just put them in an animation resource).

My current problem is that the SurfaceView part of the layout sometimes loads before the AbsoluteLayout part, so I end up showing the user roughly half of the screen with the rest of it black; sometimes this lasts for over a second.

The solution I was thinking of is to set the whole layout to invisible in its layout file, and then call setVisibility(View.VISIBLE) on it after it is inflated. However, the layout resources are (apparently) loaded asynchronously, so if I set the layout to visible right after the call to inflate it, I still get the half-loaded problem sometimes.

Is anyone aware of a callback I can override to set things to visible once the layout is fully loaded?

Che
ErnestoGuevara
Experienced Developer
Experienced Developer
 
Posts: 75
Joined: Thu Jan 08, 2009 2:02 am

Top

Postby ErnestoGuevara » Tue Jan 20, 2009 1:34 am

Thanks to Romainguy on IRC, I learned that setContentView is synchronous, so I was barking up the wrong tree.
All I needed to do was move the call to my drawing thread's start() method from onSurfaceCreated to right after the contentView is set.

Che
ErnestoGuevara
Experienced Developer
Experienced Developer
 
Posts: 75
Joined: Thu Jan 08, 2009 2:02 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 10 guests