@Override protected void onDestroy() { handlerThread.quitSafely(); super.onDestroy(); }
/** * Stops the background thread and its {@link Handler}. */ private void stopBackgroundThread() { mBackgroundThread.quitSafely(); try { mBackgroundThread.join(); mBackgroundThread = null; mBackgroundHandler = null; } catch (InterruptedException e) { e.printStackTrace(); } }
private void stopBackgroundThread() { if (Build.VERSION.SDK_INT > 17) { backgroundThread.quitSafely(); } else backgroundThread.quit(); try { backgroundThread.join(); } catch (InterruptedException e) { Log.e(TAG, "stopBackgroundThread: ", e); } finally { backgroundThread = null; backgroundHandler = null; } }
@Override public void onDestroy() { if (D) Log.d(TAG, "Destroying service"); super.onDestroy(); // Remove any sound effects final Intent audioEffectsIntent = new Intent( AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION); audioEffectsIntent.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, getAudioSessionId()); audioEffectsIntent.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, getPackageName()); sendBroadcast(audioEffectsIntent); cancelNotification(); mAlarmManager.cancel(mShutdownIntent); mPlayerHandler.removeCallbacksAndMessages(null); if (CommonUtils.isJellyBeanMR2()) mHandlerThread.quitSafely(); else mHandlerThread.quit(); mPlayer.release(); mPlayer = null; mAudioManager.abandonAudioFocus(mAudioFocusListener); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) mSession.release(); getContentResolver().unregisterContentObserver(mMediaStoreObserver); closeCursor(); unregisterReceiver(mIntentReceiver); if (mUnmountReceiver != null) { unregisterReceiver(mUnmountReceiver); mUnmountReceiver = null; } mWakeLock.release(); }
mHandlerThread.quitSafely(); else mHandlerThread.quit();
/** * Stops the background thread and its {@link Handler}. */ private void stopBackgroundThread() { mBackgroundThread.quitSafely(); try { mBackgroundThread.join(); mBackgroundThread = null; mBackgroundHandler = null; } catch (InterruptedException e) { e.printStackTrace(); } }
private void stopBackgroundThread() { if (Build.VERSION.SDK_INT > 17) { mBackgroundThread.quitSafely(); } else mBackgroundThread.quit(); try { mBackgroundThread.join(); } catch (InterruptedException e) { Log.e(TAG, "stopBackgroundThread: ", e); } finally { mBackgroundThread = null; mBackgroundHandler = null; } }
@Override protected void finalize() throws Throwable { if (mPictureThread != null) { mPreviewThread.quitSafely(); } if (mPictureThread != null) { mPictureThread.quitSafely(); } super.finalize(); }
@Override protected void onDestroy() { super.onDestroy(); handlerThread.quitSafely(); }
private void destoryIfNeed() { stopExec(); if (mHandler != null) { mHandler.removeCallbacksAndMessages(null); mHandler = null; } if (mThread != null) { mThread.quitSafely(); mThread = null; } }
private void stopBackgroundThread() { Log.i(LOGTAG, "stopBackgroundThread"); if(mBackgroundThread == null) return; mBackgroundThread.quitSafely(); try { mBackgroundThread.join(); mBackgroundThread = null; mBackgroundHandler = null; } catch (InterruptedException e) { Log.e(LOGTAG, "stopBackgroundThread"); } }
private void stopBackgroundThread() { Log.i(LOGTAG, "stopBackgroundThread"); if(mBackgroundThread == null) return; mBackgroundThread.quitSafely(); try { mBackgroundThread.join(); mBackgroundThread = null; mBackgroundHandler = null; } catch (InterruptedException e) { Log.e(LOGTAG, "stopBackgroundThread"); } }
private void stopBackgroundThread() { Log.i(LOGTAG, "stopBackgroundThread"); if(mBackgroundThread == null) return; mBackgroundThread.quitSafely(); try { mBackgroundThread.join(); mBackgroundThread = null; mBackgroundHandler = null; } catch (InterruptedException e) { Log.e(LOGTAG, "stopBackgroundThread"); } }
@Override public void onDestroy() { mHandler.removeCallbacks(mAnimateRunnable); mPioThread.quitSafely(); try { mLedColors[0] = Color.BLACK; mLedstrip.write(mLedColors); mLedstrip.close(); } catch (IOException e) { Log.e(TAG, "Exception closing LED strip", e); } super.onDestroy(); }
@Override protected void onDestroy() { super.onDestroy(); if (mediaPlayer.isPlaying()) { mediaPlayer.release(); } handlerThread.quitSafely(); }
@SuppressLint("NewApi") private static void quitHandlerThread(HandlerThread handlerThread) { if (Utils.isJellybeanMR2OrLater()) { handlerThread.quitSafely(); } else { handlerThread.quit(); } } }
public void stop() { Log.d(TAG, "Stop SensorHub"); backgroundThread.quitSafely(); closeCollectors(); iotCoreClient.disconnect(); }
/** * Stops the background thread and its {@link Handler}. */ private void stopBackgroundThread() { backgroundThread.quitSafely(); try { backgroundThread.join(); backgroundThread = null; } catch (final InterruptedException e) { LOGGER.e(e, "Exception!"); } }
/** * Stops the background thread and its {@link Handler}. */ private void stopBackgroundThread() { backgroundThread.quitSafely(); try { backgroundThread.join(); backgroundThread = null; } catch (final InterruptedException e) { LOGGER.e(e, "Exception!"); } }
private void stopBackgroundThread() { backgroundThread.quitSafely(); try { backgroundThread.join(); backgroundThread = null; backgroundHandler = null; } catch (InterruptedException e) { callbackHandler.onError(new Error(Error.ERROR_DEFAULT_CODE, e)); } }