Check out about the ViewGroup class.
This should do the trick:
for(int i=0 ; i<((ViewGroup) layout).getChildCount() ; i++) {
if(((ViewGroup) layout).getChildAt(i) instanceof Button) {
// Here is your first Button!
}
}
EDIT : I just added ViewGroup
casts to my answer, just in case the implicit conversion would raise a ClassCastException.