Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Open PDF file from assets
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jovish P  
View profile  
 More options Oct 30 2012, 6:03 am
From: Jovish P <android.f...@gmail.com>
Date: Tue, 30 Oct 2012 15:31:06 +0530
Local: Tues, Oct 30 2012 6:01 am
Subject: Open PDF file from assets

In our application we are storing few pdf files inside asstes folder(<1MB).
Using Intent we want to open that pdf.  Is it possible ? If yes,  how to do
that ?

What we tried :

If we copy file from assets to sd card and then try to open using intent it
is working.
But we directly want to open it from assets folder.

Regards,
Jovish


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos A. M. dos Santos  
View profile   Translate to Translated (View Original)
 More options Oct 30 2012, 7:49 pm
From: "Carlos A. M. dos Santos" <unixma...@gmail.com>
Date: Tue, 30 Oct 2012 21:47:14 -0200
Local: Tues, Oct 30 2012 7:47 pm
Subject: Re: [android-developers] Open PDF file from assets

On Tue, Oct 30, 2012 at 8:01 AM, Jovish P <android.f...@gmail.com> wrote:
> In our application we are storing few pdf files inside asstes folder(<1MB).
> Using Intent we want to open that pdf.  Is it possible ? If yes,  how to do
> that ?

It's hard to help if you don't provide enough information about your problem.

> 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?

--
"The flames are all long gone, but the pain lingers on"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TreKing  
View profile  
 More options Oct 30 2012, 9:28 pm
From: TreKing <treking...@gmail.com>
Date: Tue, 30 Oct 2012 20:21:28 -0500
Local: Tues, Oct 30 2012 9:21 pm
Subject: Re: [android-developers] Open PDF file from assets

On Tue, Oct 30, 2012 at 6:47 PM, Carlos A. M. dos Santos <

unixma...@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 <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jovish P  
View profile  
 More options Oct 31 2012, 1:12 am
From: Jovish P <android.f...@gmail.com>
Date: Wed, 31 Oct 2012 10:39:49 +0530
Local: Wed, Oct 31 2012 1:09 am
Subject: 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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Latimerius  
View profile  
 More options Oct 31 2012, 6:03 am
From: Latimerius <l4t1m3r...@gmail.com>
Date: Wed, 31 Oct 2012 11:00:30 +0100
Local: Wed, Oct 31 2012 6:00 am
Subject: Re: [android-developers] Open PDF file from assets

On Wed, Oct 31, 2012 at 2:21 AM, TreKing <treking...@gmail.com> wrote:
> 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.

FYI apparently you don't need any permissions to access another app's
assets.  I was surprised too, but see here:

https://groups.google.com/forum/?fromgroups=#!searchin/android-develo...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
TreKing  
View profile   Translate to Translated (View Original)
 More options Oct 31 2012, 10:06 am
From: TreKing <treking...@gmail.com>
Date: Wed, 31 Oct 2012 08:59:19 -0500
Local: Wed, Oct 31 2012 9:59 am
Subject: Re: [android-developers] Open PDF file from assets

On Wed, Oct 31, 2012 at 5:00 AM, Latimerius <l4t1m3r...@gmail.com> wrote:
> FYI apparently you don't need any permissions to access another app's
> assets.  I was surprised too, but see here:

> https://groups.google.com/forum/?fromgroups=#!searchin/android-develo...

I stand corrected. Thanks for the clarification!

--------------------------------------------------------------------------- ----------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos A. M. dos Santos  
View profile   Translate to Translated (View Original)
 More options Nov 1 2012, 8:05 am
From: "Carlos A. M. dos Santos" <unixma...@gmail.com>
Date: Thu, 1 Nov 2012 10:03:38 -0200
Local: Thurs, Nov 1 2012 8:03 am
Subject: Re: [android-developers] Open PDF file from assets

On Wed, Oct 31, 2012 at 3:09 AM, Jovish P <android.f...@gmail.com> wrote:
> 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 see. So I suggest you to create a content provider and invoke the
third-party app with a corresponding intent (supposing that the viewer
is able to read from a provider, of course). That would be the elegant
and fancy approach.

A not-so-fancy solution is to copy the PDF to the SD card and invoke
the viewer app with a file:// URI. This approach has a disadvantage:
it's hard to know when the copy can be removed because you don't know
when the viewer will stop accessing it.

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

--
"The flames are all long gone, but the pain lingers on"

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bob  
View profile  
 More options Nov 1 2012, 3:22 pm
From: bob <b...@coolfone.comze.com>
Date: Thu, 1 Nov 2012 12:22:55 -0700 (PDT)
Local: Thurs, Nov 1 2012 3:22 pm
Subject: Re: [android-developers] Open PDF file from assets

You could always create a 'boot receiver' that deletes the file on next
boot:  

     <receiver android:name=".Boot_Receiver" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"


                </action>
            </intent-filter>
        </receiver>

public class Boot_Receiver extends BroadcastReceiver
{

@Override
public void onReceive(Context context, Intent intent)
{
// delete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »