Will This Code Open a PDF?

Discussion in 'Android Questions' started by Fixx42, Feb 7, 2012.

  1. Fixx42

    Fixx42 Member Licensed User

    Hello all,

    As a newbie android programmer, I am in the somewhat difficult position of attempting to code an android app without owning android device, and would thus very much appreciate your help with what I fear may be a silly question.

    If I put the PDF file GoldLineFeb2012.pdf into the "files" tab of my program in Basic4Android, will the following code open that PDF (in an external viewer, I assume)? When I attempt to run it in the emulator, it tells me "no applications can perform this action". I'm not sure if that's because the emulator lacks a PDF viewer, or because of a problem with my code. And without an android device of my own I am unable to test it first-hand.

    Thanks a lot for the help!

    GudEvil likes this.
  2. warwound

    warwound Expert Licensed User

  3. Fixx42

    Fixx42 Member Licensed User

    Awesome, thanks Warwound, I'll give that a shot.
  4. fpdianzen

    fpdianzen Member Licensed User

    give this a try,
    it worked for me :)

    Intent1.Initialize(intent1.ACTION_VIEW, "file://" & File.Combine(directory & "/", Value))   intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
  5. gapi

    gapi Active Member Licensed User

    It is the first time for me. Where should I put the code intent ? I've a pdf files on my sdcard, thanks!
  6. NJDude

    NJDude Expert Licensed User

    You can place that code on a Button for example:
    Sub Button1_Click

    Dim Intent1 As Intent

    "file://" & File.Combine(directory & "/", Value))


    End Sub
    yiankos1, JOTHA and Theera like this.
  7. gapi

    gapi Active Member Licensed User

    ;) tnx
  8. enrico

    enrico Active Member Licensed User

    It works in my device, but it opens the pdf with google docs in the browser and not with Adobe Reader or RepliGo Reader even if I set them to default application.
    It doesn't work in the emulator even if I install Adobe Reader ("No application can perform this action").
  9. JOTHA

    JOTHA Well-Known Member Licensed User

    This works in my app also! THX !!!
  10. thehe

    thehe Member Licensed User

    The AAA.pdf file is in my app files folder .
    How to change the code to read this
  11. DonManfred

    DonManfred Expert Licensed User

    Only your app is allowed to read this folder. To let another app open it you need to copy the file to another dir.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice