2

Possible Duplicate:
using ContentProviderClient vs ContentResolver to access content provider

I am trying to read an image file, but I am getting this parameter from the viewer app as my activity is invoked:

content://media/external/images/media/5820

I tried to read it using a File object, but the path is not valid. What is the proper way to get the content of the file in a byte[]?

Community
  • 1
  • 1
loic tregan
  • 155
  • 1
  • 2
  • 7

1 Answers1

2

Use below code to open uri

ContentResolver cr = mContext.getContentResolver();
InputStream is = cr.openInputStream("content://media/external/images/media/5820");
nandeesh
  • 24,740
  • 6
  • 69
  • 79