What is the order that garbage collection collects references in this case:
Activity -> Button -> Anonymous class for onClickListener.
How all this is garbage collected when onClickListener holds reference to the wrapping class (Activity)?
If you're never passing your Button or listener outside the Activity, then this does not effect the GC process at all. They will all get garbage collected when the Activity is no longer referenced anywhere.