@Override public void onResume() { super.onResume(); DataList.getmDetailInformations().clear(); DataList.getmDetailLPinformation().clear(); try { readDataToDisk.ReadBPData(); readDataToDisk.ReadLPData(); } catch (Exception e) { Log.e(TAG, "onCreate: " + e.toString()); } mFragmentStatePagerAdapter.notifyDataSetChanged(); TimeTool.setNowDate(new Date()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TimeTool.setNowDate(new Date()); readDataToDisk = ReadDataToDisk.getInstance(MainInterfaceActivity.this); top_bn01 = (ImageButton) findViewById(R.id.activity_main_return); top_bn02 = (ImageButton) findViewById(R.id.activity_main_landing); bottom_deatil = (ImageButton) findViewById(R.id.activity_main_detail); bottom_mony = (ImageButton) findViewById(R.id.activity_main_mony); bottom_circle = (ImageButton) findViewById(R.id.activity_main_circle); bottom_myself = (ImageButton) findViewById(R.id.activity_main_myself); ton_bnfinsh = (Button) findViewById(R.id.activity_main_finish); mViewPage = (ViewPager) findViewById(R.id.activity_main_pageview); mFragmentManager = getSupportFragmentManager(); top_bn02.setOnClickListener(this); ton_bnfinsh.setOnClickListener(this); mFragmentStatePagerAdapter = new FragmentStatePagerAdapter(mFragmentManager) { @Override public Fragment getItem(int position) { if (position == 0) { if (DataList.getmDetailInformations().isEmpty()) { return WaringFragment.getInstacne(0); } else { return new IndivListFragment(); } } else if (position == 1) { if (DataList.getmDetailLPinformation().isEmpty()) { return WaringFragment.getInstacne(1); } else { return new IndivListLPFragment(); } } else { return WaringFragment.getInstacne(1); } } @Override public int getItemPosition(Object object) { return POSITION_NONE; } @Override public int getCount() { return 2; } }; mViewPage.setAdapter(mFragmentStatePagerAdapter); /*if(DataList.getmDetailInformations().isEmpty()){ mViewPage.setCurrentItem(1); }*/ }