Well, this seems like a good exercise to test my learning and reading as a
newbie in the Android scene.

If I'm understanding BobG correctly, he means that the calls to onDraw
depend entirely on your application.  Your *Hello World!* sample renders the
text once and never has to render anything again -- the view stays put as
you left it.  It's a callback: when something happens (like user input),
then onDraw() might be called if something new has to be drawn.

A game, for example, might process game logic at each frame.  This results
in onDraw() being called for each frame, since game logic might place a game
object in a position different from that it was in during the last frame.

Hello World, as mentioned, doesn't need to be updated in that way.  That's
why onDraw() is not called anymore.

With regards to the "zombie" sentiment, onDraw() does not actually take up
any more memory than any other function might take; it is called when
needed, I suspect, much like onCreate(), onStart(), onResume, onDestroy() do
(these are methods involved in an activity's life cycle; check out the
Android Application fundamentals page
here<http://developer.android.com/guide/topics/fundamentals.html#lcycles>
to
see where I'm pulling these potentially wrong statements from).  From what
I've read, Android does things in a very, very, very modular manner;
everything is "there" and safe until it's needed.

I'm guessing that if you were to press "Home" or "Back" while *Hello
World!*was running, then you brought it back to the foreground, it
would call
onDraw() again.

If I'm wrong in anything I've said, please correct me!  I hope that helps.

-Danny

On Mon, Apr 19, 2010 at 7:27 AM, BobG <bobgard...@aol.com> wrote:

> On Apr 19, 9:08 am, "~ TreKing" <treking...@gmail.com> wrote:
> > I don't know what you're asking. Activities don't really "run" like
> threads
> > that have a definite function that gets executed to do work. They have
> > functions that are invoked in response to system events (onCreate,
> onPause,
> > onConfigurationChanged, etc).
> =====================================================
> Here is my 'model' that compares an embedded program to an android
> program:
> embedded program: main gets called by os, main calls initstuff(),
> falls into a while(1) loop that calls inputs(), process() and
> outputs() forever. The os can kill it if it has to. In the android
> program, the onCreate is the init, the os scheduler is the while(1)
> loop, and the onSensorChanged events are like the input and process
> functions, and the onDraw is like the output function. Sort of. Does
> this model make sense to anyone else? Can it be explained more clearly
> by another model?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to