Skip to content

Commit

Permalink
fix orientation change crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kotya341 committed Feb 13, 2015
1 parent 3bb94cd commit 2c23bff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Expand Up @@ -9,6 +9,7 @@
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/java/yalantis/com/sidemenu/sample/MainActivity.java
Expand Up @@ -40,12 +40,10 @@ public class MainActivity extends ActionBarActivity implements ViewAnimator.View
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
if (savedInstanceState == null) { contentFragment = ContentFragment.newInstance(R.drawable.content_music);
contentFragment = ContentFragment.newInstance(R.drawable.content_music); getSupportFragmentManager().beginTransaction()
getSupportFragmentManager().beginTransaction() .replace(R.id.content_frame, contentFragment)
.add(R.id.content_frame, contentFragment) .commit();
.commit();
}
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
drawerLayout.setScrimColor(Color.TRANSPARENT); drawerLayout.setScrimColor(Color.TRANSPARENT);
linearLayout = (LinearLayout) findViewById(R.id.left_drawer); linearLayout = (LinearLayout) findViewById(R.id.left_drawer);
Expand Down

0 comments on commit 2c23bff

Please sign in to comment.