title: Video recording using Intent saves empty file
body: <p>This is the code i used to record video from an android device in MP4 format. The file is being created but is of 0 bytes size.
  Here is my code :-</p>
  
  <pre><code>Button buttonStart;
  File newFile;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      initUI();
      buttonStart.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              try {
                  newFile = File.createTempFile("vid", ".mp4", Environment.getExternalStorageDirectory());
              } catch (IOException e) {
                  e.printStackTrace();
              }
              Uri outputFileUri = Uri.fromFile(newFile);
              Intent record = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
              record.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
              startActivityForResult(record, 5);
          }
      });
  }
  
  protected void initUI(){
      buttonStart = (Button) findViewById(R.id.buttonRecord);
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      if(requestCode == 5){
          if(resultCode == RESULT_OK){
              try {
                  newFile = File.createTempFile("vid", ".mp4", Environment.getExternalStorageDirectory());
              } catch (IOException e) {
                  e.printStackTrace();
              }
              Toast.makeText(this, "Video Captured Successfully...!!", Toast.LENGTH_LONG).show();
  
          }
      }
  }
  </code></pre>
  
  <p>I don't understand what has gone wrong.
  Can anybody help me ...
  Thanks</p>