The dispatch pattern in Android

Refer to a composite pattern if you wish here

Views and view groups in android form a composite pattern


m1()
  onM1()
  dispatchM1()

draw() {
  ...
  onDraw() //myself
  dispatchDraw() //children
  ....
}

Android dispatch pattern: wonder if anyone else is talking about this!

Search for: Android dispatch pattern


ViewGroup {

onDraw() { implment own draw };

override
dispatchDraw() {
  for each child
     child.draw()
}
}

m1()
  onM1()
  dispatchM1()
    child.m1()

Here is a list of (Gang of Four) design patterns

One should keep these handy, especially the tricksies like the visitor!