What's the difference between File.toURI vs Uri.fromFile in Android -



What's the difference between File.toURI vs Uri.fromFile in Android -

while trying image using photographic camera intent describe in documentation. i've added required mediastore.extra_output problem didn't save file wanted. read documentation more carefully, , compared doing (since didn't blindly copy/pasted provided sample code), , found using

intent.putextra(mediastore.extra_output, myfile.touri());

instead of

intent.putextra(mediastore.extra_output, uri.fromfile(myfile));

the sec version worked perfectly, can't figure out why. documentation both methods don't state related incompatibility between two.

shouldn't 2 give same result, or missing subtle difference?

the content produced uri.fromfile() , file.touri() not same...

for same file "f" located on sdcard.

"f.touri()" add together bundle {output=file:/mnt/sdcard/gp/gp.db}

and "uri.fromfile(f)" add together {output=file:///mnt/sdcard/gp/gp.db}

android

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -