-1

I want to show docx file in my app.In one of the api calls the returned response contains url to a docx file.I just need to show that docx file and no edit.Can i directly open it via intent or should i first convert it into image file format and then show in imageview.

Rajesh Gosemath
  • 1,812
  • 1
  • 17
  • 31

1 Answers1

0

Can i directly open it via intent

You can try. Create an ACTION_VIEW Intent, pointing at the DOCX file. Wrap your startActivity() call in a try/catch block, to catch ActivityNotFoundException. If that is raised, there is no exported activity on the device that can handle your Intent, so if your Intent is set up properly, there is no DOCX viewer.

should i first convert it into image file format and then show in imageview

There is nothing in Android itself for converting DOCX into anything, let alone an image. Also, many DOCX files have more than one page, which means a single image file is unlikely to be useful. Either set up a server that can convert the DOCX into something (e.g., ZIP of HTML and images, PDF) that is more likely to be viewable on the device, or license some sort of DOCX viewing library (if one exists).

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491