简体   繁体   中英

Android: Video Record using default camera

Below is my code and I'm gonna integrate with the application. My problem is when the button clicked video recorder invoked and video recoded smoothly but I want to get the response from the camera when the video recording is done every time.

public class AndroidVideoActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button btnVideoRecorder = (Button)findViewById(R.id.buttonClick);
        btnVideoRecorder.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent intent = new Intent("android.media.action.VIDEO_CAMERA");
                startActivity(intent);

            }
        });
    }
}

Can someone please guide me.

Thanks for your time in advance.

Try changing

startActivity(intent);

to

startActivityForResult(intent);

Then when the video is done recordng, it will return to your app and you will be able to do something with the video

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM