Example #1
0
 @Override
 protected void onDestroy() {
   alertDialog.dismiss();
   materialDialog.dismiss();
   alertDialog = null;
   materialDialog = null;
   // NetStateReceiver.unRegisterNetworkStateReceiver(getApplicationContext());
   NetStateReceiver.removeRegisterObserver(mNetChangeObserver);
   MApplication.getInstance().finishActivity(this);
   PreOnDestroy();
   super.onDestroy();
 }
Example #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    materialDialog = new MaterialDialog(this);
    alertDialog = new SpotsDialog(this, R.style.CustomDialog);
    MApplication.getInstance().addActivity(this);

    mNetChangeObserver =
        new NetChangeObserver() {
          @Override
          public void onNetConnected(NetUtils.NetType type) {
            super.onNetConnected(type);
            onNetworkConnected(type);
          }

          @Override
          public void onNetDisConnect() {
            super.onNetDisConnect();
            onNetworkDisConnected();
          }
        };
    NetStateReceiver.registerObserver(mNetChangeObserver);
    // NetStateReceiver.registerNetworkStateReceiver(getApplicationContext());
  }