Reputation: 13385
How to get the window token of the window to which decorview is attached?
Upvotes: 0
Views: 2101
Reputation: 62189
If I have understood your question correctly, then this is my answer:
getWindow().getDecorView().addOnAttachStateChangeListener(
new View.OnAttachStateChangeListener() {
@Override public void onViewAttachedToWindow(View v) {
getWindow().getDecorView().removeOnAttachStateChangeListener(this);
IBinder binder = v.getWindowToken();
}
@Override public void onViewDetachedFromWindow(View v) {
}
});
Upvotes: 1