package org.attentiveness.news.detail;

import android.os.Bundle;

import org.attentiveness.news.R;
import org.attentiveness.news.base.BaseActivity;
import org.attentiveness.news.list.NewsListFragment;

public class NewsDetailActivity extends BaseActivity {

    private int mStoryId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news_detail);
        setup();

        this.mStoryId = getIntent().getIntExtra(NewsListFragment.EXTRA_ID, 0);


        NewsDetailFragment newsDetailFragment = (NewsDetailFragment) getSupportFragmentManager().findFragmentById(R.id.cl_container);
        if (newsDetailFragment == null) {
            newsDetailFragment = NewsDetailFragment.newInstance(this.mStoryId);
            addFragment(getSupportFragmentManager(), R.id.cl_container, newsDetailFragment);
        }

        NewsDetailPresenter presenter = new NewsDetailPresenter(newsDetailFragment);
    }

}

@@ -252,16 +252,81 @@
 vity %7B%0A%0A
+    private static final String INSTANCE_STORY_ID = %22story_id%22;%0A%0A
     priv
@@ -343,16 +343,16 @@
 toryId;%0A
-
 %0A    @Ov
@@ -532,16 +532,62 @@
 tup();%0A%0A
+        if (savedInstanceState == null) %7B%0A    
         
@@ -657,16 +657,116 @@
 ID, 0);%0A
+        %7D else %7B%0A            this.mStoryId = savedInstanceState.getInt(INSTANCE_STORY_ID);%0A        %7D
 %0A%0A      
@@ -1211,10 +1211,192 @@
 %0A    %7D%0A%0A
+    @Override%0A    protected void onSaveInstanceState(Bundle outState) %7B%0A        super.onSaveInstanceState(outState);%0A        outState.putInt(INSTANCE_STORY_ID, this.mStoryId);%0A    %7D%0A
 %7D%0A

Save story id