Removed listview itmes when android device orientation changed
<p>I have a MainActivity with one fragment. I have a ListView in pager which is inside fragment of MainActivity. Now when device orientation is changed ListView is not showing any items that were shown before :</p>

<p>MainFragment.java :</p>

<pre><code>    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container,
                    false);

    if (myGrp == null)
                myGrp = new ArrayList&lt;List&lt;String&gt;&gt;();

    mActivityAdapter = new MyGroupsAdapter(myContext, myGrp);

    mSectionsPagerAdapter = new SectionsPagerAdapter(
                    myContext.getSupportFragmentManager());
            mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
            mViewPager.setAdapter(mSectionsPagerAdapter);

    mViewPager.setCurrentItem(1);
    }

    public class SectionsPagerAdapter extends FragmentPagerAdapter {

            public SectionsPagerAdapter(FragmentManager fm) {
                super(fm);
            }

            @Override
            public Fragment getItem(int position) {
                Fragment fragment = new DummySectionFragment();
                Bundle args = new Bundle();
                args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1);
                fragment.setArguments(args);
                return fragment;
            }

            @Override
            public int getCount() {
                // Show 3 total pages.
                return 3;
            }

            @Override
            public CharSequence getPageTitle(int position) {
                Locale l = Locale.getDefault();
                switch (position) {
                case 0:
                    return getString(R.string.title_section3).toUpperCase(l);
                case 1:
                    return getString(R.string.title_section2).toUpperCase(l);
                case 2:
                    return getString(R.string.title_section1).toUpperCase(l);
                }
                return null;
            }
        }

    public View onCreateView(LayoutInflater inflater,
                    final ViewGroup container, Bundle savedInstanceState) {
                View dummyView = null;
                if (getArguments().getInt(ARG_SECTION_NUMBER) == 1) {
                    dummyView = inflater.inflate(R.layout.inbox_fragment,
                            container, false);
                    ListView mListView = (ListView) dummyView
                            .findViewById(R.id.inbox_listview);
                    mListView.setAdapter(inboxAdapter);
                    mListView
                            .setOnItemLongClickListener(new OnItemLongClickListener() {

                                @Override
                                public boolean onItemLongClick(AdapterView&lt;?&gt; arg0,
                                        View arg1, int position, long id) {
                                    MainFragment fragment = new MainFragment();
                                    fragment.inboxItem_onLongClick(id);
                                    return false;
                                }
                            });
                } else if (getArguments().getInt(ARG_SECTION_NUMBER) == 2) {
                    dummyView = inflater.inflate(R.layout.chat_fragment, container,
                            false);
                    ListView mListView = (ListView) dummyView
                            .findViewById(R.id.chatGroupList);
                    mListView.setAdapter(mActivityAdapter);
                } else if (getArguments().getInt(ARG_SECTION_NUMBER) == 3) {
                            //any things 
                      }
    }
}



@Override
    public void onResume() {
        super.onResume();
        SharedPreferences prfs = myContext.getSharedPreferences("user_info",
                Context.MODE_PRIVATE);
        GroupsSaved = prfs.getBoolean("GroupsSaved", false);

        if (myGrp == null || myGrp.size() == 0)
            getMyGroups();

        Global.nowChatGrpID = 0;
        mActivityAdapter.notifyDataSetChanged();
    }
</code></pre>