Converting file:// scheme to content:// scheme?

You probably want to convert content:// to file: For gallery images, try something like this: Uri myFileUri; Cursor cursor = context. GetContentResolver(). Query(uri,new String{android.provider.MediaStore.Images.ImageColumns.

DATA}, null, null, null); if(cursor.moveToFirst()) { myFileUri = Uri. Parse(cursor. GetString(0)).getPath(); } cursor.close.

You probably want to convert content:// to file:// For gallery images, try something like this: Uri myFileUri; Cursor cursor = context. GetContentResolver(). Query(uri,new String{android.provider.MediaStore.Images.ImageColumns.

DATA}, null, null, null); if(cursor.moveToFirst()) { myFileUri = Uri. Parse(cursor. GetString(0)).getPath(); } cursor.close.

Solved it before I read this. But this is what I did. Anyway, I can support Files and Astro return data in format file:// by trimming the "file://" away and pass it to BitmapFactory.decodeFile.

Thanks for responding. – user445299 Jun 10 at 2:34.

Use ContentResolver.openInputStream() or related methods to access the byte stream. You shouldn't generally be worrying about whether it is a file: or content: URI. developer.android.com/reference/android/...).

Sometimes you want to able to pass the URI you got from some application to another application. Then conversion is useful, as some applications are picky about what kind of URIs they accept (I learnt this the hard way. ) Still looking for solution though... – Juozas Kontvainis Jul 27 at 15:15 @hackbod, there's a bug with Uri when you swap out the sdcard for another sdcard.

The Uri points to a different picture. – user445299 Sep 20 at 5:44 1 That's not a Uri bug, that is just... well what do you expect? :) If you have a path to a file, and swap the underlying filesystem to something else with different contents, you can't count on that path being meaningful anymore.

The only wrinkle here is that URIs for the media content provider are not paths but created with a unique ID for each file it has scanned. When you put in a different SD card, the old database will be dropped and the files re-scanned and assigned new ids, so if you have any URIs from the old card they will either be invalid or randomly ref a file on the new card. – hackbod Sep 21 at 18:08.

I am running to the problem with using Droid X's Files app and Astro file manager to select an image file. This two apps return the selected image with the scheme "file://" while Gallery returns the image with the scheme "content://". How do I convert the first schema to the second.

Or how do I decode the image with the second format?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions