Created
November 1, 2014 04:33
-
-
Save msomu/4869bea2a197ad4a4579 to your computer and use it in GitHub Desktop.
Know when the users change their phone orientation to Landscape or Potrait
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <activity | |
| android:name=".MyActivity" | |
| android:label="@string/app_name" | |
| android:configChanges="orientation|screenSize"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void onConfigurationChanged(Configuration newConfig) { | |
| super.onConfigurationChanged(newConfig); | |
| if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE){ | |
| Log.d("SOMU","Orientation Changed to Landscape mode"); | |
| } | |
| else if(newConfig.orientation==Configuration.ORIENTATION_PORTRAIT){ | |
| Log.d("SOMU","Orientation Changed to Potrait mode"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment