Overriding getWindowToken() - Safe?
<p>I have some UI attached directly using WindowManager.addView(..) (This UI is an overlay that can be called from other applications and for other reasons, I don't want this to be in an activity). This UI is showing on a layer type of APPLICATION_PANEL.</p>

<p>I have to show a contextual menu on this UI. I'm using a PopupMenu to do this, but it results in errors related to the window token not being that of an activity's.
Looking inside PopupMenu's code, I found that it is using getWindowToken() from the anchor view we pass in. I overrode that method in the anchor view I use, to return a valid application token and it works.</p>

<p>Is it safe to override the getWindowToken() on the view that I attach the popup menu to? The popup works if I do this but will there be other ramifications?</p>

<p>Thanks!</p>
