Friday, 15 March 2013

java - I want to download the file from server and view the file in android with various file Extensions like (pdf,doc,mp4,jpeg)) -



java - I want to download the file from server and view the file in android with various file Extensions like (pdf,doc,mp4,jpeg)) -

i want download file server , view file in android various file extensions (pdf,doc,mp4,jpeg) have seek

intent intent = new intent(intent.action_view); file file1 = new file(environment.getexternalstoragedirectory(),"report.pdf"); intent.setdataandtype( uri.fromfile( file1 ), "application/.*" ); startactivity(intent);

but no success should have give individual extension in please suggest way solve

see code reference

filepath actual path of file

uri fileuri = uri.fromfile(new file(filepath)); uri new_uri = uri.parse("file://" + fileuri.getpath()); intent intent = new intent(intent.action_view, new_uri); mimetypemap mymime = mimetypemap.getsingleton(); string fileext = filepath.substring(filepath .lastindexof(".") + 1); string mimetype = mymime .getmimetypefromextension(fileext); intent.setdataandtype(new_uri, mimetype); startactivity(intent);

java android pdf

No comments:

Post a Comment