@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity_layout); TitleFragment titleFragment = TitleFragment.getInstance(); getSupportFragmentManager() .beginTransaction() .replace(R.id.title_fragment, titleFragment) .commitAllowingStateLoss(); adapter = new OrderAdapter(this, 0); fragment = FlightOrderListFragment.getInstance(); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_layout, fragment) .commitAllowingStateLoss(); payUtil = new UnipayUtil(this); payUtil.setOnPayFinishedListener( new OnPayFinishedListener() { @Override public void onPayfinished(boolean isSuccessed) { fragment.setContentShown(false); getOrderList(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity_layout); String text = ""; selectCityType = getIntent().getIntExtra("code", 1); switch (selectCityType) { case IndexActivity.REQUEST_CODE_DEPART: text = "选择出发城市"; selectedCityModel = pageCache.departCity; break; case IndexActivity.REQUEST_CODE_ARRIVE: text = "选择到达城市"; selectedCityModel = pageCache.arriveCity; break; case IndexActivity.REQUEST_CODE_DSIPATCH: text = "选择配送城市"; selectedCityModel = pageCache.arriveCity; break; case 4: text = "选择出发城市"; selectedCityModel = settingCache.departCityModel; break; } getSupportFragmentManager() .beginTransaction() .replace(R.id.title_fragment, new SubPageTitleFragment(false, text)) .commitAllowingStateLoss(); adapter = new CityAdapter(this, 0); DataBaseHelper helper = new DataBaseHelper(this); ArrayList<FlightCityModel> list = helper.getFlightCitys(); ArrayList<FlightCityModel> hotCitylist = helper.getHotFlightCitys(); FlightCityModel model = new FlightCityModel(); model.cityName = "热门城市"; model.cityCode = "TITLE"; adapter.add(model); for (FlightCityModel hotCityModel : hotCitylist) { adapter.add(hotCityModel); } sectionPositions.add(0); String[] firstLetters = getResources().getStringArray(R.array.firse_letter); StringBuffer sb = new StringBuffer(); sb.append("#"); for (String letter : firstLetters) { FlightCityModel titleModel = new FlightCityModel(); titleModel.cityName = letter; titleModel.cityCode = "TITLE"; adapter.add(titleModel); sectionPositions.add(adapter.getCount() - 1); for (FlightCityModel cityModel : list) { if (cityModel.firstLetter.equalsIgnoreCase(letter)) { adapter.add(cityModel); } } sb.append(letter); } mSections = sb.toString(); Log.e("----mSections----", mSections + ""); fragment = CityListViewFragment.getInstance(); getSupportFragmentManager() .beginTransaction() .replace(R.id.fragment_layout, fragment) .commitAllowingStateLoss(); }