androidx.fragment.app.Fragment.onDestroy()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(208)

本文整理了Java中androidx.fragment.app.Fragment.onDestroy()方法的一些代码示例,展示了Fragment.onDestroy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fragment.onDestroy()方法的具体详情如下:
包路径:androidx.fragment.app.Fragment
类名称:Fragment
方法名:onDestroy

Fragment.onDestroy介绍

暂无

代码示例

代码示例来源:origin: trello/RxLifecycle

@Override
public void onDestroy() {
  lifecycleSubject.onNext(FragmentEvent.DESTROY);
  super.onDestroy();
}

代码示例来源:origin: trello/RxLifecycle

private void testLifecycle(LifecycleProvider<FragmentEvent> provider) {
  Fragment fragment = (Fragment) provider;
  startFragment(fragment);
  TestObserver<FragmentEvent> testObserver = provider.lifecycle().skip(1).test();
  fragment.onAttach(null);
  fragment.onCreate(null);
  fragment.onViewCreated(null, null);
  fragment.onStart();
  fragment.onResume();
  fragment.onPause();
  fragment.onStop();
  fragment.onDestroyView();
  fragment.onDestroy();
  fragment.onDetach();
  testObserver.assertValues(
    FragmentEvent.ATTACH,
    FragmentEvent.CREATE,
    FragmentEvent.CREATE_VIEW,
    FragmentEvent.START,
    FragmentEvent.RESUME,
    FragmentEvent.PAUSE,
    FragmentEvent.STOP,
    FragmentEvent.DESTROY_VIEW,
    FragmentEvent.DESTROY,
    FragmentEvent.DETACH
  );
}

代码示例来源:origin: guardianproject/haven

@Override
public void onDestroy() {
  super.onDestroy();
  if (cameraViewHolder != null)
    cameraViewHolder.destroy();
}

代码示例来源:origin: trello/RxLifecycle

private void testLifecycle(LifecycleProvider<FragmentEvent> provider) {
  Fragment fragment = (Fragment) provider;
  startFragment(fragment);
  TestObserver<FragmentEvent> testObserver = provider.lifecycle().skip(1).test();
  fragment.onAttach(null);
  fragment.onCreate(null);
  fragment.onViewCreated(null, null);
  fragment.onStart();
  fragment.onResume();
  fragment.onPause();
  fragment.onStop();
  fragment.onDestroyView();
  fragment.onDestroy();
  fragment.onDetach();
  testObserver.assertValues(
    FragmentEvent.ATTACH,
    FragmentEvent.CREATE,
    FragmentEvent.CREATE_VIEW,
    FragmentEvent.START,
    FragmentEvent.RESUME,
    FragmentEvent.PAUSE,
    FragmentEvent.STOP,
    FragmentEvent.DESTROY_VIEW,
    FragmentEvent.DESTROY,
    FragmentEvent.DETACH
  );
}

代码示例来源:origin: ankidroid/Anki-Android

@Override
public void onDestroy() {
  super.onDestroy();
  if (mFullNewCountThread != null) {
    mFullNewCountThread.interrupt();
  }
  Timber.d("onDestroy()");
}

代码示例来源:origin: trello/RxLifecycle

TestObserver<Object> destroyViewObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onDestroy();
attachObserver.assertNotComplete();
createObserver.assertComplete();

代码示例来源:origin: cSploit/android

@Override
public void onDestroy() {
  stopNetworkRadar();
  StopRPCServer();
  mRadarReceiver.unregister();
  mUpdateReceiver.unregister();
  mWipeReceiver.unregister();
  mMsfReceiver.unregister();
  mConnectivityReceiver.unregister();
  // make sure no zombie process is running before destroying the activity
  System.clean(true);
  super.onDestroy();
}

代码示例来源:origin: trello/RxLifecycle

TestObserver<Object> destroyViewObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onDestroy();
attachObserver.assertNotComplete();
createObserver.assertComplete();

代码示例来源:origin: westnordost/StreetComplete

@Override public void onDestroy()
{
  super.onDestroy();
  compass.onDestroy();
  if(mapView != null) mapView.onDestroy();
  controller = null;
  directionMarker = null;
  accuracyMarker = null;
  locationMarker = null;
}

代码示例来源:origin: schaal/ocreader

@Override
public void onDestroy() {
  if(webView != null) {
    webView.destroy();
    webView = null;
  }
  super.onDestroy();
}

代码示例来源:origin: jaredsburrows/android-gradle-java-app-template

@Override
public void onDestroy() {
  if (adView != null) {
    adView.destroy();
  }
  super.onDestroy();
}

代码示例来源:origin: fennifith/Alarmio

@Override
public void onDestroy() {
  alarmio.removeListener(this);
  super.onDestroy();
}

代码示例来源:origin: Sparker0i/Weather

@Override
public void onDestroy() {
  super.onDestroy();
  gps.stopUsingGPS();
}

代码示例来源:origin: saki4510t/libcommon

@Override
public void onDestroy() {
  internalRelease();
  super.onDestroy();
}

代码示例来源:origin: vbier/habpanelviewer

@Override
public void onDestroy() {
  if (mDiscovery != null) {
    mDiscovery.terminate();
    mDiscovery = null;
  }
  super.onDestroy();
}

代码示例来源:origin: jruesga/rview

@Override
public void onDestroy() {
  super.onDestroy();
  // Dismiss confirmation dialog
  if (mDialog != null) {
    mDialog.dismiss();
    mDialog = null;
  }
}

代码示例来源:origin: jruesga/rview

@Override
public void onDestroy() {
  super.onDestroy();
  if (mGoogleApiClient != null) {
    mGoogleApiClient.disconnect();
  }
}

代码示例来源:origin: commonsguy/cwac-presentation

/**
 * Called when the fragment is no longer in use. Destroys the internal state of the WebView.
 */
@Override
public void onDestroy() {
 if (mWebView != null) {
  mWebView.destroy();
  mWebView = null;
 }
 super.onDestroy();
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onDestroy()
{
  super.onDestroy();
  TorrentTaskServiceReceiver.getInstance().unregister(serviceReceiver);
  if (!saveTorrentFile && info != null)
    TorrentHelper.cancelFetchMagnet(info.sha1Hash);
}

代码示例来源:origin: contentful/gallery-app-android

@Override public void onDestroy() {
 cancelPaletteTask();
 if (target != null) {
  Picasso.get().cancelRequest(target);
  target = null;
 }
 bitmap = null;
 super.onDestroy();
}

相关文章