When you click on the button, this method works:

public void onRecordVideo(View v) { if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); File mediaFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/myvideo.mp4"); videoUri = Uri.fromFile(mediaFile); intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri); startActivityForResult(intent, VIDEO_CAPTURE); } else { Toast.makeText(this, "Нет камеры", Toast.LENGTH_LONG).show(); } } 

And he goes into the camera, and when you click on the checkmark, goes back. And the video plays in a VideoView .

Question: Is it possible to make it so that when you click on a button, a new page does not open and opens in VideoView or in some other block, but only in this Activity ? If so, how?

  • Use preview cameras and record videos in your own way, rather than using a standard camera. - Nikotin N
  • Do you want to record video in your application without using the Camera application? - Vladyslav Matviienko
  • Yes, record video in the LinearLayout block or something else without opening the Camera app - DevOma

1 answer 1

You need to add a surfaceview to the markup. And using Camera, SurfaceView, SurfaceHolder to record video in their own way. Here is a detailed example of [ http://startandroid.ru/ru/uroki/vse-uroki-spiskom/264-urok-132-kamera-vyvod-izobrazhenija-na-ekran-obrabotka-povorota.html ] [ http: // startandroid .ru / en / uroki / vse-uroki-spiskom / 266-urok-133-kamera-delaem-snimok-i-pishem-video.html ]

  • Camera out of date ?? - DevOma