Test getClass().getName() to see if it is "android.widget.PopupWindow$PopupViewContainer", presumably.
Of course, there may be a better solution for whatever it is you are trying to do, but your rationale behind walking the view hierarchy this way escapes me. On Fri, Jan 27, 2012 at 5:14 PM, plnelson <[email protected]> wrote: > (I posted this on Stack Overflow but as of this writing I've received no > response) > > I'm writing code that starts with a View object in a layout hierarchy and > iteratively walks up the tree to the view root, using getParent(), > displaying information about each level as it goes. > > Everything is working fine except for PopupWindow, which is one of the > classes I want to display. All the other ones in my layout are derived > directly or indirectly from the View class, e.g., LinearLayout, > RelativeLayout, Button etc. So I get the Parent View (vPar) and do a > > Object obj = (Object)vPar; > > To test for, say, RelativeLayout I can then do a . . . > > if (obj instanceof RelativeLayout ) { > > ... > > But this doesn't work for PopupWindow. Even though PopupWindow is derived > from Object, when it's in a layout it's shown as > "PopupWindow$PopupViewContainer" in the debugger. And PopupViewContainer is > not part of the public API, according to > http://www.kiwidoc.com/java/l/x/android/android/5/p/android.widget/c/PopupWindow.PopupViewContainer > . > > So how do I test to see if I have a PopupWindow as I'm walking up the > hierarchy? > > Thanks in advance!! > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 4.0 Programming Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

