public void onDestroy() { running = false; if (scanThread != null) scanThread.interrupt(); if (myWLocate != null) myWLocate.doPause(); sensorManager.unregisterListener( this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)); if (scanData.getmView() != null) { ((WindowManager) getSystemService(WINDOW_SERVICE)).removeView(scanData.getmView()); scanData.setmView(null); } try { if (wl != null) wl.release(); } catch (RuntimeException re) { } wl = null; try { scanThread.join(1000); } catch (InterruptedException ie) { } System.exit(0); }
private void downloadImageThread() { Thread thread = new Thread(null, runInBackground, "Background"); thread.start(); try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } }
private void restartMap() { breakMapThread = true; postInvalidate(); if (mapThread != null) try { mapThread.join(1500); } catch (InterruptedException ie) { } mapThread = new Thread(this); mapThread.start(); }
public static void audioQuit() { if (mAudioThread != null) { try { mAudioThread.join(); } catch (Exception e) { Log.v("SDL", "Problem stopping audio thread: " + e); } mAudioThread = null; // Log.v("SDL", "Finished waiting for audio thread"); } if (mAudioTrack != null) { mAudioTrack.stop(); mAudioTrack = null; } }
@Override protected void onDestroy() { super.onDestroy(); Log.v("SDL", "onDestroy()"); // Send a quit message to the application SDLActivity.nativeQuit(); // Now wait for the SDL thread to quit if (mSDLThread != null) { try { mSDLThread.join(); } catch (Exception e) { Log.v("SDL", "Problem stopping thread: " + e); } mSDLThread = null; // Log.v("SDL", "Finished waiting for SDL thread"); } }
// Called when we lose the surface public void surfaceDestroyed(SurfaceHolder holder) { // Log.v("SDL", "surfaceDestroyed()"); // Send a quit message to the application SDLActivity.nativeQuit(); // Now wait for the SDL thread to quit if (mSDLThread != null) { try { mSDLThread.join(); } catch (Exception e) { Log.v("SDL", "Problem stopping thread: " + e); } mSDLThread = null; // Log.v("SDL", "Finished waiting for SDL thread"); } enableSensor(Sensor.TYPE_ACCELEROMETER, false); }