Skip to content

Instantly share code, notes, and snippets.

@shakalaca
Created December 10, 2012 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shakalaca/4251100 to your computer and use it in GitHub Desktop.
Save shakalaca/4251100 to your computer and use it in GitHub Desktop.
Detect current window size for Samsung Multi-Window system
mRootContainer = (RelativeLayout) findViewById(R.id.root_container);
ViewTreeObserver vto = mRootContainer.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// get current window size
int newWidth = mRootContainer.getWidth();
int newHeight = mRootContainer.getHeight();
// do whatever you want ...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment