Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. @Override
  2. public void onConfigurationChanged(Configuration newConfig) {
  3. super.onConfigurationChanged(newConfig);
  4. checkOrientation(newConfig);
  5. }
  6.  
  7. private void checkOrientation(Configuration newConfig){
  8. // Checks the orientation of the screen
  9. if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
  10. Log.d("OrientationMyApp", "Current Orientation : Landscape");
  11. // Your magic here for landscape mode
  12. } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
  13. Log.d("OrientationMyApp", "Current Orientation : Portrait");
  14. // Your magic here for portrait mode
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement