how to get layout and elements inside ViewStub (generated from SDK) in android programmatically?

207 Views Asked by At

I am using an SDK which is displaying a popup on performing some action in app. By using WindowManager i am able to get views on the screen as:

  • 1) My home screen (android.view.ViewRootImpl@e33bea5: DecorView@82c1e88[Dashboard])
  • 2) Login success Toast (Toast/android.view.ViewRootImpl@8bca27a: android.widget.LinearLayout)
  • 3) com.PopupActivity/android.view.ViewRootImpl@62e8a2b: DecorView@d099e07[PopupActivity]

The 3rd one (PopupActivity) has 2 children:

  • 1) ViewStub
  • 2) ImageButton

I am able to access ImageButton like, ((ImageButton)obj).performClick(); but i am not able to access the contents of ViewStub. ViewStub has only few methods like getInflaterId(), getLayoutResource(), etc.

I have seen some articles saying, we can initially take the layout id which is inside view stub and then keep playing with that layout id, whereas in my case, i dont know the layout id because the SDK in inflating that viewstub.

Now, How do i access the contents of ViewStub?

0

There are 0 best solutions below