Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Camera Video intent returns null URI
    primarykey
    data
    text
    <p>I recently got updated to Android 4.3 and the stock video camera started acting a little weird whenever I started it with an Intent from my app.</p> <p>At first it would just crash and say "Gallery stopped responding". After a little while, I was able to record a video, but clicking on done returned a null URI to my app, which made it crash!</p> <p>So I set out testing a 2.3.4 device with the same code. The video app returned a proper URI I could use on that device. The same code worked perfectly fine before I got 4.3 (had 4.2.2 stock Galaxy Nexus)</p> <p>Here's an activity that get a null URI from the stock camera app of 4.3 but works fine on devices with 4.2.2 and less.</p> <pre><code>public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button pick = (Button) findViewById(R.id.button1); pick.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); startActivityForResult(takeVideoIntent, 123); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode == RESULT_OK){ if(requestCode == 123){ VideoView videoView = (VideoView) findViewById(R.id.videoView1); videoView.setVideoURI(data.getData()); Log.d("Video", "URI "+data.getData()); } } super.onActivityResult(requestCode, resultCode, data); } } </code></pre> <p>What do I do so that this never happens? Does this mean that this will work differently with other camera apps on different manufacturer devices?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload