2

In the olden days developing windows applications I made use of an API call (LOCKWINDOWUPDATE(HWND)). It would lock updating of the screen while you do stuff so that if you don't want the user to see a complex series of UI changes you can prevent that from occurring. You'd lock the updating by passing in the handle to the window to stop updating, do your changes and then you'd unlock by passing (0) and boom, it's in the new state.

As I understand this is not the intended use of the call but I did it anyway (as did many others) because it was too useful in a lot of situations. Anyhoo, there have been many occasions with Android that I could have made use of such functionality and today I have a need for it again. Does anyone know of any equivalent APIs or techniques to accomplish this?

Again, I want to have the screen freeze at a current state make changes and then show it when it's in the new state. Any idea?

Geeks On Hugs
  • 1,591
  • 2
  • 18
  • 31
  • What kind of dynamic screen changes are you talking about? Is it game related or simply standard XML-inflating layout drawing? – Michael Banzon Aug 02 '13 at 23:54
  • @mbanzon Well it's closer to standard XML stuff but it does use a surface view. The previous dev did some "black magic" with object references (that's not fully understood yet, so I'm not ready to change it) and there is a point where an image view is stored very briefly on the screen. There is a case where this operation is visible to the user (the image changes briefly). If I could prevent them from seeing this update that would be good enough for now. – Geeks On Hugs Aug 03 '13 at 00:00
  • For `SurfaceView` the `getHolder()` method and `lockCanvas()` method(s) of the `SurfaceHolder` class might help? – Michael Banzon Aug 03 '13 at 00:05
  • 1
    @AnthonyTanas : You can build (inflate) entire views "in-memory" then set them as the content of an existing placeholder view. You might even consider using Fragments and calling `replace()` on a FragmentTransaction. – Squonk Aug 03 '13 at 00:37
  • @mbanzon I'll try that tomorrow and let you know how it works. Sounds promising. If it works you should make a regular response so I can give credit. Thanks! – Geeks On Hugs Aug 06 '13 at 00:04
  • @Squonk those are good suggestions (especially the fragment one) however I'm trying to get by with minimal code changes for now. I'm a big fan of fragments though. – Geeks On Hugs Aug 06 '13 at 00:04

0 Answers0