0

Can i possibly get the layout of my activity when back key was pressed? or something that could identify the contentView of that Activity?

ロン 産
  • 51
  • 7

2 Answers2

2
((ViewGroup)findViewById(android.R.id.content)).getChildAt(0)

This should return you the Root View of current activity

Klawikowski
  • 605
  • 3
  • 11
0

Add id to your parent view of layout and then get the reference by using findViewById() providing the id of the parent view.

Khawar Raza
  • 15,870
  • 24
  • 70
  • 127