Tuesday, October 30, 2012

Re: [android-developers] Open PDF file from assets

When user clicks on a button i want to open the pdf file stored inside our application(ie which is inside Assets folder of our app). Open means , to view the pdf file using Intent. I don't have any problem in  using third party applications to  view pdf file.In the intent i sepcify mimetype , so it will list all the pdf viewer installed in his phone. So user can select his favorite pdf viewer to view the pdf file which is stored in our application

<some-context-instance>.getAssets().open(assetName) will return inputstream. That is not wht we need. Thanks for this suggestion

I guess now everything is clear. sorry for my bad English.

Regards,
Jovish


Regards,
Jovish

On Wed, Oct 31, 2012 at 6:51 AM, TreKing <trekingapp@gmail.com> wrote:
On Tue, Oct 30, 2012 at 6:47 PM, Carlos A. M. dos Santos <unixmania@gmail.com> wrote:
> What we tried :
>
> If we copy file from assets to sd card and then try to open using intent it
> is working.

What are you using to "open" the PDF files? Do you mean "view/display"
or "read the file". Android does not support PDF natively so I suppose
that you use either an external application or a PDF rendering
library.

> But we directly want to open it from assets folder.

Doesn't <some-context-instance>.getAssets().open(assetName) work for you?

As you said, reading PDFs is not a native feature and requires an external app, which would not have permission to read the PDF from another app's Assets folder.

I believe the OP would have to write his own PDF viewer imbedded in his app, or stick with the "copy to SDcard then open" strategy.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment