Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract the real file URI or file data from a path that looks like "/content:/media/external/video/media/19"?

Tags:

android

I am desperately trying to send a captured video to a server. The problem is that the URI that is given by the built-in camera application is not the real file path. It looks like this - /content:/media/external/video/media/19.

How can I access the real path or the data directly from this kind of URIs?

After reading the android documentation I saw that it looks like a content provider's notation, but I still don't have a clue how to reach the data that I need. Please help!!!

thanks in advance

like image 881
maddob Avatar asked Mar 02 '12 14:03

maddob


1 Answers

How can I access the real path or the data directly from this kind of URIs?

You don't. It might not exist as a file. Or, it might not exist as a file that you can read except via the ContentProvider.

Instead, use a ContentResolver to open an InputStream on that Uri, and use that InputStream to transfer the data to a server.

like image 193
CommonsWare Avatar answered Oct 10 '22 03:10

CommonsWare