Filenotfoundexception When Trying To Upload A Recorded Video To Server From Android App
I'm trying to record a video and then upload it to a server upon its completion. Relevant code is here: public void recordVideo(View view){ Intent takeVideoIntent = new Intent(
Solution 1:
I ended up finding another question on here that had some code that helped me out:
privateStringgetRealPathFromURI(Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(contentUri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
Then in my handleCameraVideo
method:
privatevoidhandleCameraVideo(Intent intent) {
UrimVideoUri= intent.getData();
Stringdata= getRealPathFromURI(mVideoUri);
FilevidFile=newFile(data);
....
This works and gets me the right file.
Post a Comment for "Filenotfoundexception When Trying To Upload A Recorded Video To Server From Android App"