Hello.I have created a flex mobile project to open and show a native PDF file in Android. I have tried three different methods below , but I failed.
1. I created a stagewebview and used "stageWebView.loadURL". I can see the PDF View in emulator but it didn't work in Android Pad (SAMSUNG Galaxy Tab 10.1). It showed blank screen.
Note that I have installed AIR 3.3.
stageWebView1.loadURL(new File(new File("app:/assets/ZUGH-2P.pdf").nativePath).url);
2. I created a stagewebview and used stagewebview to load javascript. The javascript could run in emulator, but it didn't work in Android Pad. I failed again.
stageWebView1.loadURL(new File(new File("app:/assets/JavaScripthtml.html").nativePath).url);
3. I imported stagewebviewbridge, which is the extended version of stagewebviewbridge. I created a stagewebviewbridge , but it could not run in emulator. I failed again.
stageWebViewbridge1.loadLocalURL( "appfile:/assets/pdf.html");
could any one give me some suggestions? Many thanks.
Thanks a lot! ![]()
I have tried your method, and I used "navigateToURL" to open the web with the browser. I could open a remote PDF file in http website.
Unfortunately, I could not open the native PDF file.
The codes are below.
navigateToURL(new URLRequest("app:/assets/ZUGH-2P.pdf"),"_blank");
It worked well in emulator, but failed in Android Pad. The OS alerted "file path error".
Is anything wrong in my codes?
Dear jrunrandy,
I have work on this problem for a long time.But I was unable to
solve it. How can I open a native PDF file? The browser showed that
file path was incorrect. How can I form the right file path?My
codes are below.
navigateToURL(new URLRequest("app:/assets/ZUGH-2P.pdf"),"_blank");
It worked very well in emulator, but failed in Android Pad.
I noticed that you are an employee of Adobe company.
Could you please give me some suggestion in detail? Thank you very
much.
@peterpan_cafuc,
Sorry to say that I'm not sure of the answer, either.
One suggestion would be to try something like File.openWithDefaultApplication(), although I've never tried it on mobile.
Also, I poked around stackoverflow, and it looks like people have done this using Android Intents, but you might have to use a Native Extension to do this in AIR.
Apologies that I can't be more helpful.
-Randy
I think the solution is an Android Native Extension to which you pass the path and file name. It would in turn call Android's file handling routines which would trigger the dialog asking which application should be used ... or if one was already associated with that file type, it would launch it.
I found such an extension here http://activeden.net/item/document-launcher-native-extension-for-andro id/2015733 I have not tried it and can't vouch for it, but it seems to do what you are looking for.
North America
Europe, Middle East and Africa
Asia Pacific