I tried to capture video using camera intent and gets the video in onActivityResult. Its working fine except for certain situations.
When i capture video for a long time in certain phones, and when i click save button, it returns to the camera itself. And when i press back button from there it returns to my app, but to a new activity.
// Calling camera intent
Intent intent = new Intent(
android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(intent, 1);
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent videoReturnedIntent) {
super.onActivityResult(requestCode, resultCode, videoReturnedIntent);
if (resultCode == RESULT_OK) {
float size = 0;
Uri selectedVideo = videoReturnedIntent.getData();
String[] filePathColumn = { MediaStore.Video.Media.DATA };
Cursor cursor = getContentResolver().query(selectedVideo,
filePathColumn, null, null, null);
if (cursor != null) {
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
filePath = cursor.getString(columnIndex);
cursor.close();
}
}
}