public void onDestroy() { // savePreferences("myPref"); // savePreferences("preferences"); if (!isRecording) { Log.i(TAG, "in onDestroy"); if (conn != null) { try { conn.stop(); } catch (Exception e) { Log.i(TAG, "Error in socket close: " + e.getMessage()); } } stop = true; super.onDestroy(); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ipfield = (EditText) findViewById(R.id.ipfield); portfield = (EditText) findViewById(R.id.portfield); captureButton = (Button) findViewById(R.id.button_capture); captureButton.setOnClickListener(this); // onStartCommand(); SurfaceView cameraView = (SurfaceView) findViewById(R.id.camera_preview); holder = cameraView.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // constructorVideo(); }
@Override protected void onPause() { super.onPause(); releaseMediaRecorder(); // if you are using MediaRecorder, release it first releaseCamera(); // release the camera immediately on pause event }