This is my onclick code

public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent i = new Intent();
                i.setAction(Intent.ACTION_VIEW);

i.setDataAndType(Uri.parse("file:///raw/unlockingandroid.pdg"),
"application/pdf");
                try{
                    startActivity(i);
                }
                 catch (ActivityNotFoundException e) {
                     Toast.makeText(pdfviewer.this,
                         "No Application Available to View PDF",
                         Toast.LENGTH_SHORT).show();
                 }

            }

I see a toast when i click the button :( i cant see the pdf

On Wed, Dec 29, 2010 at 12:26 PM, Jake Basile <[email protected]> wrote:

> Just like opening any other type of file on Android, you should try to
> launch an intent to view it.
>
> Intent openPdfIntent = new Intent();
> intent.setAction(Intent.ACTION_VIEW);
> intent.setDataAndType(Uri.fromFile(pdfFile), "application/pdf");
> try
> {
>     startIntent(openPdfIntent);
> }
> catch(ActivityNotFoundException e)
> {
>     // No app can open PDF files on their phone.
> }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to