16

Are there classses in Android that can open different kind of files like pps, ppt, docs, rtf, etc.?

Please provide links.

blahdiblah
  • 33,069
  • 21
  • 98
  • 152
user493244
  • 909
  • 7
  • 19
  • i think not so. In Android no built-in classes, external packages may available like google apis. check it once. – Yugandhar Babu Dec 20 '11 at 10:22
  • 2
    using Intent.ACTION_VIEW, if any application available that open/support file. – Hiren Dabhi Dec 20 '11 at 10:53
  • I dont want to open through other applications. – user493244 Dec 20 '11 at 11:00
  • 2
    It is not going to be very easy. You will have to develop decoding and rendering for each type of file. Text will be the easiest, you can just read and display in a TextView. But, for pdf and others, you will have to go through the specifications, read raw bytes of the files, then decode and populate your own developed data structures, then in most cases renders with drawing API. If opening through 3rd party app was not forbidden for you, you could do it with 2/3 lines (same for all types) – Sarwar Erfan Dec 20 '11 at 12:09
  • Depending on your requirements, using the [Google Docs Viewer](https://docs.google.com/viewer) might be a viable option. It's certainly plenty versatile. – blahdiblah Jan 05 '12 at 21:20

3 Answers3

6
WebView mWebView = (WebView) findViewById( R.id.WebView01);
String pdfurl = ""; // Url of pdf or doc file.

String weblink="http://docs.google.com/gview?embedded=true&url="+pdfurl;    
mWebView.loadUrl(weblink);
atrivedi
  • 348
  • 1
  • 4
  • 12
4

No, there is no native API provided by android, you can use some third party APIs to read pdf and all.

COD3BOY
  • 11,964
  • 1
  • 38
  • 56
Saurabh Pareek
  • 7,126
  • 4
  • 28
  • 29
0

Some of them can open using default activity with ACTION_VIEW. For other we have to external API to open them. But i am not sure which one will definitely open using ACTION_VIEW but you can give a try to them by using URI.

But most important thing as Saurabh Pareek said there is not native classes in android

COD3BOY
  • 11,964
  • 1
  • 38
  • 56
Tofeeq Ahmad
  • 11,935
  • 4
  • 61
  • 87