Added onAttach onDetach hook to ViewImpl

Instead of doing this, you could use an anonymous inner class...