Take a look at the Lunar Lander from API Demos. On May 17, 6:53 am, Heuristic <[email protected]> wrote: > Thanks for the reply, Dianne. I wished I had got your answer before I > made further changes earlier - I draw the drawings onto another image > buffer and copy the image buffer back to the real image view. (This is > what I learned before that it could make the drawing smooth so that > there is no flicker like you said.) It turned out to be useless > anyway. > Like you said - Android's drawing will not draw until the drawing is > complete. What I want is to draw is the moving of the tower of hanoi > in a step by step way so that the users could see the moving - not the > end of the moving. > > I see that Android has some animation mechanism. I wonder if I could > start an animation thread, then uses the images that I draw as an > animation source for the animation. Theoretically, it should work. > But, I hate that I might find out that it's not what I think. > I believe that I can associate a view with an animation. Then, I could > start an animation that plays the images I create one by one. That > probably will work. But, I am new to Android, so I have no idea about > Android animation at this moment. > Thanks anyway. > > On May 17, 10:27 am, Dianne Hackborn <[email protected]> wrote: > > > > > Android's drawing model is totally different, so it can provide a smoother > > experience without flicker. When drawing your window, you need to > > completely draw it and the result is not composited to the screen until all > > drawing is complete, so the user never seen flicker and artifacts due to > > partially drawn windows on screen. > > > You just need to learn how Android works. Yes, it does not use AWT, so you > > just need to learn the way that Android does drawing just like if you were > > coming from any other platform. > > > On Tue, May 17, 2011 at 1:11 AM, Heuristic <[email protected]> wrote: > > > I write an Android Java program to "simulate" the moving of Tower of > > > Hanoi. > > > The drawing does not show in steps I expected, instead it shows in a > > > chunk at the end of the drawing. Why? > > > The scenario can been seen in my personal website - > > > 1. I set the disc number to be 5. > > >http://homepage8.seed.net.tw/web@3/heuristic/TOH_Set051411001.JPG > > > 2. Then, I start the moving. (I used the sleep timer so that it won't > > > move too fast.) > > >http://homepage8.seed.net.tw/web@3/heuristic/TOH_Start051411001.JPG > > > 3. It ends up with the BLACK piles of the discs on the two other > > > sticks as shown on the following URL: > > >http://homepage8.seed.net.tw/web@3/heuristic/TOH_End051411001.JPG > > > (This is due to an error in my program. It's fixed.) > > > > The button "start" is used to trigger the movement. I can see that the > > > button's color is changed and hold there until all the drawings are > > > done, then the color of the button is reset to original. This is not > > > what I want. I want to show - moving the disc 1 from stick 1 to stick > > > 2, then moving the disc 2 from stick 1 to stick 3, and so on. It does > > > not show this - it shows the last step that finishes the tower of > > > hanoi movement. > > > > I wrote this Java program long time ago using Java Applet (and it > > > works as an application with little modification). The library used to > > > draw is AWT only. Now, I just changed the interface to be Android GUI/ > > > API interface. > > > The old program works fine on my website (in fact, in my all > > > showoffs.) - > > >http://homepage8.seed.net.tw/web@3/heuristic/tohjava.html > > > > This program was developed on Android 2.1-updated. I just ported to > > > 3.0, it shows the first time, then halts there. I haven't got time to > > > figure out. > > > > This is a very good educational material - to teach Math, Java, > > > Computer Sciences, etc. > > > Hope experienced Android guy can share experience here. This is a > > > little bit like the "flush" in some i/o problem. Sometimes, if you > > > don't flush, there is no output. So, why Android does not show the > > > drawing out right away, instead it waits until the end of all the > > > drawings. > > > It looks like that using threads could solve the problem. But, it's > > > too much of the work for just drawing some object movings. Anyone has > > > any idea how to make the programming simpler and easier for a simple > > > task like this? > > > > How come Android not provide the AWT library? Is it too big or too > > > clumsy? It's just some simple drawings, why do you want your > > > developers to write so many codes for a simple task like this? > > > Is there a way that the displaying view (view to show the images) > > > sends a message to the button and asks the button to release the > > > control to the view so that the view can draw the drawings as it > > > should do. I think it's the button control holds the operation until > > > the called routine exits. Painting or drawing should be independent > > > of the processes that activate the painting or drawing like AWT, > > > right? > > > Any idea? > > > > -- > > > 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 > > > -- > > Dianne Hackborn > > Android framework engineer > > [email protected] > > > Note: please don't send private questions to me, as I don't have time to > > provide private support, and so won't reply to such e-mails. All such > > questions should be posted on public forums, where I and others can see and > > answer them.- Hide quoted text - > > > - Show quoted text -
-- 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

