@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mOnSaveInstanceStateInvoked = false; if (savedInstanceState == null) { setContentView(R.layout.activity_main); MapView mapView = (MapView) findViewById(R.id.mapView); mMapManager = MapManager.getInstance(); mMapManager.init(this, mapView); myFragmentManager = MyFragmentManager.getInstance(); myFragmentManager.init(getApplicationContext(), getSupportFragmentManager(), this); myFragmentManager.switchFragment( IntentHelper.getInstance().getSingleIntent(MainFragment.class, null)); ServiceEngin.getInstance().init(this); LoginHelper.checkLogin( this, new LoginHelper.OnCheckLoginListener() { @Override public void onAgree() { myFragmentManager.showFragment( IntentHelper.getInstance().getSingleIntent(LoginFragment.class, null)); } @Override public void onCancel() {} }); } }
@Override public void onBackPressed() { if (!ServiceEngin.getInstance().canclDialog() && myFragmentManager != null) { myFragmentManager.onBackPressed(); } }