mardi 30 juin 2015

Android display files from URL GET

I'm working on the Android version of an app I did for iOS. I have some files (could be PDF, DOC, PNG, etc) in cloud storage and I retrieve them using an ASPX handler (like http://ift.tt/1LAkGXR).

In iOS I used a UIWebView and it would download and preview the file as long as the OS could handle that file type.

What is the best approach for Android? I've tried the following:

  • WebView and embedding in google docs (http://ift.tt/1hRPyTl) - DOES NOT WORK FOR PNG
  • Launching a new Activity using myIntent.setDataAndType(myFileURI, myFileMIME); where myFileMIME = MimeTypeMap.getSingleton().getMimeTypeFromExtension(myFileTypeExtension). For PNGS I get "No activity for type image/png"

Aucun commentaire:

Enregistrer un commentaire