Skip to content

Instantly share code, notes, and snippets.

@omegasoft7
Last active August 29, 2015 14:11
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 omegasoft7/41881f9dabaf6eb7d340 to your computer and use it in GitHub Desktop.
Save omegasoft7/41881f9dabaf6eb7d340 to your computer and use it in GitHub Desktop.
Make orientation without destroy and reload activity
//ON Activity
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
//Landscape orientation
} else if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
//Portrate orientation
}
}
//ON AndroidManifest.xml
<activity
android:name="com.example.myActivity"
android:label=""
android:configChanges="orientation|screenSize"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment