• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Video Intent returns null

Gary52

Lurker
Hi

I am developing am app to take photos and Video and then email the file to the user. The app works fine for photos on the phone and simulator. And works fine for Video on the simulator, but when I try video on the phone it returns a null pointer on the line Uri u = data.getData(). The phone I have tried it on is the HTC. Has anybody got any ideas what am doing wrong as its driving me crazy!

Thank you in advance.

Gary52




{
ContentValues values = new ContentValues ();
values.put(MediaStore.Video.Media.MIME_TYPE, "video/3gp");
values.put(MediaStore.Video.Media.DESCRIPTION, "Video");

ImageUri = getContentResolver().insert (android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values);

Intent camera = new Intent (android.provider.MediaStore.ACTION_VIDEO_CAPTURE);


camera.putExtra (android.provider.MediaStore.EXTRA_VIDEO_QUALITY, 1);

startActivityForResult (camera, CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);
}



protected void onActivityResult (int requestCode, int resultCode, Intent data)
{
double Latitude = 0;
double Longitude = 0;
double Altitude = 0;
if (requestCode == CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE)
{
if (resultCode == RESULT_OK)
{
String srcFilePath = "";
try
{
Uri u = data.getData();
srcFilePath = u.getPath();
AlertUser ("DEBUG", srcFilePath);
} catch (Exception e)
{
AlertUser ("DEBUG", e.toString());
}

} else if (resultCode == RESULT_CANCELED)
{
AlertUser ("DEBUG", "Cancelled");
} else
{
AlertUser ("DEBUG", "Unknown Error");
}
}
}
 
Back
Top Bottom