Open a PDF file of runtime android application

Hello

I try to open a PDF file of my Android app on a phone BB10 Z10 (10.2.1).

He intended me to use 'File Viewer' with adobereader logo, but nothing happen when I click on it.

I tried to put files on different storage and directory, but I have the same problem with no error:

Public warehousing

public static String getDefaultPath() {
        return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()+"/";
}

And internal storage:

public static String getDefaultPath() {
        return context.getFilesDir().getAbsolutePath()+"/";
}

Here is my code to open the pdf file, it works fine on Android:

File file = new File(path);
if (file.exists()) {

    try {
        Toast.makeText(context, "Trying to open " +path+" => "+ file.getName(), Toast.LENGTH_LONG).show();

        Uri fileUri = Uri.fromFile(file);
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(fileUri);
        i.setType("application/pdf");
         i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(i);

    } catch (Exception e) {
        Logger.getInstance().LogException(e);
        Toast.makeText(context, "Unable to pen file..." + e.getMessage() + " " + e.getClass().getName(), Toast.LENGTH_LONG).show();

    }
} else {
    Toast.makeText(context, "File not found..." + file.getName(), Toast.LENGTH_LONG).show();

}

I do not see my camera in DDMS, there is nothing, how can I debug to check if the system returns me an error when I try to open the pdf?

Thanks for your help!

Best,

Ricken

I solved my problem.

There were actually two problems, the first is I have to use public storage for adobereader is able to access my pdf file, so I solved it by copying pdf to dir public cache before opening it and then I can keep all other protected files.

The other problem is rather strange and seems to be a bug, I replaced:

i.setData(fileUri);
i.setType("application/pdf");
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

with a little:

i.setDataAndType(fileUri, "application/pdf");

And now the pdf file is successfully opened by adobereader

Tags: BlackBerry Developers

Similar Questions

  • How to have the sidebar with thumbnails by default in the application preview? Whenever I open a PDF file, there is no sidebar.

    How to have the sidebar with thumbnails by default in the application preview?

    I'm on OSX El Capitan 10.11.3 on iMac, and whenever I open a PDF file, there is no sidebar. I have to every time click on the Sidebar icon, then select the thumbnails. I would like to be on by default, but cannot find the option or how to edit the plist file...

    If the thumbnails is checked in the menu 'View' preview, it should always open a PDF file with the open sidebar. Unless of course, it's a single page PDF.

  • When I open a pdf file in photoshop, it automatically contrast my document. I can't open it so I can see the real colors and contrast like I do in other applications. Does anyone have an idea, what's the problem here?

    When I open a pdf file in photoshop, it automatically contrast my document. I can't open it so I can see the real colors and contrast like I do in other applications. Does anyone have an idea, what's the problem here?

    I use Photoshop CC 2015. I didn't have this problem before. All started a few weeks ago.

    Hi Vigo,

    Could you please share what's working color space in Photoshop?

    Try to change it to sRGB and check again.

    You might also want to calibrate your color monitor profile and check.

    See this article for instructions: http://www.lightroomqueen.com/articles-page/how-do-i-change-my-monitor-profile-to-check-wh ether-STI-corrupted /

  • The application was unable to start correctly (0xc0000005) - keep from appearing when you open a pdf file. How can I stop this?

    I'm on a 64-bit Windows 7 Pro computer and just upgraded to the most recent Adobe Acrobat Reader DC.  When I open a PDF file a window opens saying "the application could not start (0xc0000005).  Click OK to close this application"I click OK and the window opens up again about three or four times before it finally stopped.  My PDF file is then visible.  This is driving me crazy!  I tried to use "Repair Installation" in the Menu Help, but it has no effect.  I downloaded and installed the latest update - and this miserable message keeps popping up!  Before you do a system restore to revert to the previous version, can someone please tell me how to solve this problem?  Thank you very much.

    Hello

    There might be a chance of the previous version left overs. Try uninstalling Acrobat using cleaning tool: http://labs.adobe.com/downloads/acrobatcleaner.html

    Then try to reinstall it and then see if that solves the problem.

    Concerning

    Sukrit diallo

  • Using a desktop PC I'm opening a PDF file and trying to save as a WORD document.  The application continues to send me subscribe to convert the document that I already did before.  Is there another way I should try to convert?

    Using a desktop PC I'm opening a PDF file and trying to save as a WORD document.  The application continues to send me subscribe to convert the document that I already did before.  Is there another way I should try to convert?

    The see often when someone pays for a product buy us tries to use another. Less often if the subscription fails.

    So, what exactly did you pay?

  • Hello, I created an application of DPS, and I want that when you click on an image, it opens a pdf file. But this one is on the ipad.  This is where there is no internet connection.   Thank you.

    Hello

    I created an application of DPS, and I want that when you click on an image, it opens a pdf file. But this one is on the ipad.

    This is where there is no internet connection.

    Thank you.

    Put the PDF file in a file HTMLResources.zip.

  • How to open the pdf file residing on the server to the client computer applications?

    Hi all
    The scenario is that I've developed a form using forms10g (9.0.4). I wrote the following lines in the module of the form, there is a button.in the code for this button.
    AppID: = DDE. App_Begin ("C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe C:\2dayDBA.pdf', DDE.") App_Mode_Maximized);
    ConvID: = DDE. Insider ("Acrobat", '2dayDBA.pdf');
    Now when I run the form and click the button, it opens the pdf "2dayDBA.pdf" file and it works fine.
    My problem is that when I deploy the same form on Oracle application server and copy the pdf files in the same location with acrobat reader installed at the same place and run the formula browser client and press
    the button, it does not open the pdf file and gives me the error "Exception no Oracle".

    someone has the solution for this. (don't forget I want to just open the pdf file of the client)
    its really urgent

    Kind regards
    abbasyazdani

    Stop and then restart the OC4J container, and then try again.

    François

  • I get the same error message and cannot open a PDF file

    I have a link to an application that I am trying to download and complete. By default the link my browser to open. what he does normally. However, this document was a mistake. He said that I need the latest version of Adobe. So I downloaded the application, open the PDF file in the app and get the same error message. Help!

    Hello

    You see the following error message when you open the PDF document?

    If so, it is a special type of PDF created with Adobe LiveCycle Designer form called "Dynamic XFA".

    Acrobat Reader mobile apps (for iOS, Android, Windows Phone) do not support XFA forms.

    Please download the PDF document on your Windows or Mac computer and open it with Acrobat Reader DC desktop version.

    Please let us know if you have a different problem.

    Sorry for the inconvenience.

  • Open a pdf file in my IPad that was created by Adobe Livecycle 9

    Hello

    I have great difficulty in opening an assessment that was created in Adobe LiveCycle 9 on my I Pad 2.

    I downloaded the pdf via ITunes my I touch in the iBook.

    I have Adobe Acrobat reader on the IPad and can't open this pdf file.

    I also put this file in my IPhone without success. It has even more applications: Adobe complete and sign DC, Adobe Acrobat Reader and PDF Reader Pro

    Help, please

    André

    Hello

    Mobile products Adobe Reader (player for iOS, Android, Windows Phone) do not support any static or dynamic XFA forms created with Adobe LiveCycle Designer.

    The next page of the blog contains the response of Jeff Stanier, Product Manager of Adobe LiveCycle Designer.

    The Adobe Reader Mobile and XFA in LiveCycle Designer Forms. Adobe LiveCycle Blog

    Please use the desktop version of Adobe Reader on a Windows or Mac computer to view and complete the XFA forms.

    Sorry for the inconvenience.

  • How to open a pdf file in its native player in iOS using AIR?

    Hello

    I wonder if there is no feasibility to open a pdf file directly in its native player in the environment of iOS. I had to do since an AIR application.

    I found that AIR can be applied using a java program to run the task above for Android.

    Here is the link: http://www.jamesward.com/2011/05/11/extending-air-for-android/

    Thanks in advance,

    SRI

    Hello

    When you say native player, you mean ibooks? or the integrated web PDF Viewer?

    iBooks:

    Use the URL scheme provided by apple to call the app... you can find more information about certain patterns known to http://wiki.akosma.com/IPhone_URL_Schemes

    I him have not tested/used, but it is average of thw you can call other apps of your application.

    WebViewer:

    Create an instance of StageWebView, a load then the PDF with it:

    var view: StageWebView = new StageWebView();

    view.viewPort = new Rectangle (0,0,320,480);

    View.stage = stage;

    view.loadURL ('yourPDF.pdf');

    Note: I have not tested the latest code, it may contain errors, but you get the idea...

  • How to open a PDF file using the built-in Viewer? (Windows 8.1)

    When I try to open a PDF file I have the pop-up dialogue "you have chosen to open *.pdf Firefox do with this file? And display in Firefox is not one of the options. I am sure that what is happening is that there is no dialogue, and the PDF has just opened in the integrated Viewer pdf.js. If something is wrong with my profile I guess.

    I tried the instructions here: https://support.mozilla.org/en-US/kb/view-pdf-files-firefox-without-downloading-them

    I checked through all my extensions and you do not have open a PDF (I have uBlock, NoScript and Zotero).
    I completely uninstalled Adobe Reader.
    I checked that in preferences/Applications, PDF is set to "Preview in Firefox.
    I did as I went through: config and change all settings with 'pdf' on their return to their default values
    But none of these things work.

    Is there anything else I can try to get this working?

    I think the problem I had was that some of the PDF files is served by Web sites with a "header" (I don't really know what that means) called "Content-Disposition: attachment", and when this happens, Firefox refuses to load them into the integrated PDF Viewer. (I don't know why Web sites this.)

    It is very helpful, especially because Firefox gives no indication as to what is happening (why the user preference for a PDF file is not respected). I just thought that the PDF Viewer was broken and spent hours trying to fix it.

    If anyone runs into this problem, there is an extension that fixes it: https://addons.mozilla.org/en-us/firefox/addon/inlinedisposition/

    There is a Bugzilla bug open about it: https://bugzilla.mozilla.org/show_bug.cgi?id=773942

    As far as I can see, it would be trivial reflect changes the extension above in Firefox. In the bug of no claim that it would be a bad thing to do for safety reasons. But Firefox should at least present the user the ability to open the PDF file in the integrated Viewer or even more at least have explanations on why the PDF is not currently open in the Viewer, for example "this PDF file was marked for download, so for safety reasons it has not been opened in the integrated Viewer. Who would save people like me, who don't know the HTTP headers that are complicated, just think that Firefox is broken.

  • Why does firefox open a non-stop tab string when I try to open a PDF file?

    I don't know if it's a coincidence, but right after that I installed the latest version of Adobe flash player, firefox now opens a string with no end of new tabs, whenever I try to open a PDF file. I have to close the window and start over.

    Help?

    the machine is a HP Elitebook 8540w. Windows 7 64-bit.

    You have configured Firefox to use the Adobe Acrobat plugin? It seems that he may be missing or disabled, because it does not appear in your "more details of the system" (next to your message). You can see the page modules. Either:

    • CTRL + SHIFT + a
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click on Plugins. Then on the right, look for Adobe Acrobat. It may be down on a gray background.

    If you don't have it: Make sure that this isn't your favorite here player:

    "3-bar" menu button (or tools) > Options > Applications

    You can type or paste pdf in the search box at the top of the list after loading to filter.

    If you have it, but it cannot be activated using 'Always enable' or "Ask to activate": You may need to update. I recommend using the help inside your product Adobe (Reader or Acrobat) menu to check the updates.

    Any progress?

  • How to stop firefox from opening new tab when opening a pdf file that is already recorded on my desk?

    Windows 7 Pro 32 bit PC

    PDF files on my desk I have already registered. When I open the PDF file, firefox considers justified to open a new tab, even if I do not have the browser open. It's boring because after I close the PDF file I then have to close the browser window new tab as well. It costs me a lot of time to productivity as I opened a large number of PDF of the work. The PDF file to view the Adobe logo on the file on the desktop. Once I installed firefox displayed the logo of firefox?

    I've already put in PDF to open it with Adobe by default via Menu-Options-Applications

    Please try:
    Right-click on your .pdf file to open the context menu, select "Open with", then "choose program by default... "In the window"Open with"choose your favorite pdf-viewer and define the box always check"use the selected program to open this type of file. Then click on the OK button.

    Is this solve your problem?

  • When opening a PDF file, a new tab will open, but it will be empty, it do not download or open any pdf file, it just started the last 3 days...!

    Hello
    I'm about to remove Firefox from my computer because he lost hours of my time, and none of the online troubleshooting answers are no help.

    Until recently, I was able to open PDF files in my browser window, and today its impossible to open any pdf file, it will not download if I choose to download it.

    This issue is ongoing, and shut down for almost a year and I downloaded the Nitro PDF module to solve previously as Adobe reader add-on did nothing. Today in the menu options of applications where I can choose the program I want to open PDF files with I can't find the option NitroPDF reader, so I chose the add-on Adobe and no matter how many restarts it refuses to open all PDFs, all I get is a new tab open and empty.

    Internet Explore opens PDFs very well, so I know it's not computer associate.

    I'm running Windows Vista Ultimate, Firefox Version 19.0.

    If there is a way to fix this, please help because I am currently at the end of my patience.

    Kind regards

    Emre

    19 FF has its own Viewer for pdf files. It doesn't seem to work properly. The screens are either poor quality or empty. Printing using the bad characters and spacing of bad character. Some impressions of color and others are not.

     Thankfully, it is easy to revert to using some other pdf viewer, such as Foxit. Go to Tools / Options / Applications and scroll down to "Portable Document Formay (PDF)", and change it to your preferred pdf viewer.
     Your problem is solved!
    
  • How can I get firefox to open a pdf file in adobe instead of the new pdf reader?

    Before the recent update, 19.0, I google something and see [PDF] next to a link. I click the Center button to open it in a new tab. Firefox might download the file and open it with Adobe Reader. I like this.

    With the new update 19.0, the pdf file would open in the new tab. I have to down load it and then open it in Adobe. I don't like this.

    I'm going to preferences under applications. I look to see if I can change that. Next to document Adobe Reader, I choose to use Adobe Reader, but when I click on a link [PDF], it always opens the file in Firefox and not Adobe.

    I want to go back to the way it was.

    Problem: Open a pdf file in Firefox, he wants to save the file.
    Remedy:
    In Firefox, tools, Options, choose the column on the left (Content Type) Applications tab, select Portable Document Format (pdf). Right column (Action) choose Preview in Firefox.
    I use Firefox 21.0.
    Wednesday, may 29, 2013, Tom Budlong

Maybe you are looking for

  • How can I activate JavaScript in FireFox 26.0

    Suddenly unable to access one of my online banking accounts as they all ask me to activate JavaScript (use them all for years with FireFox0.) Also, I can not even use my Facebook account or connect more. All that asks me to ACTIVATE JAVASCRIPT and I

  • How can I activate my iCloud account?

    I recently changed my email from apple to my own most recent and then I tried connecting to my iCloud account. When he asked my password, I put my new and old and disabled password my account and told me to reset my password to activate my account. I

  • Pavilion m213: disabling hp pavilion system 14405 m213

    Installed card system refurb, has a bios password which will not be reset. System received message locked with number 14405

  • Data storage: overkill TDMS for event logs?

    I want to connect a mass, a box number, the user, and a timestamp periodically. I would also occasionally connect a string describing an event. The way I see it, there would be a group for each post office box number and a channel for each entry in t

  • What is SLOW-PCfighter?

    I now have this pop up on my dell latitude.  I bought a photo program and camera from walgreens, maybe it comes from that.  But it bothers me if he'd just sceme phishing or spam.  Is - this legitamite?  Claims it will help my computer run better.