1

I use the browser to open a pdf file, but I want to use the regular file manager in order to open the file with a third party application. How do I do that?

BrowserSession page = Browser.getDefaultSession();
page.displayPage("file:///SDCard/BlackBerry"+Integer.parseInt(tab[4])+".pdf");
Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
BurunduK
  • 293
  • 1
  • 3
  • 17

1 Answers1

0

It depends on OS version. In OS 5 RIM added the net.rim.device.api.ui.picker.FilePicker class that does what you need. For pre 5 OS you have to implement your own screen to select a file from the file-system. Your local BB SDK should contain a sample app for this, search by "fileexplorerdemo" to find that sample and to see the code.

Vit Khudenko
  • 28,288
  • 10
  • 63
  • 91
  • 1
    I have tried and it actually very close to what i need, but i need to open the file and i cannot find a way to do that, maybe there is a way with streams somehow. – BurunduK Apr 27 '11 at 13:30
  • @Victor I.: Do you mean you still have no solution for your question? – Vit Khudenko Apr 27 '11 at 15:11
  • Probably these info sources may be useful for you: http://docs.blackberry.com/en/developers/deliverables/17952/CS_reading_sections_of_a_binary_file_1222470_11.jsp and http://www.blackberry.com/developers/docs/6.0.0api/javax/microedition/io/file/FileConnection.html – Vit Khudenko Apr 27 '11 at 15:27
  • 1
    it seems that Invocation invocation; invocation = new Invocation("file://SDCard/BlackBerry/PopFax/39508844.pdf"); Registry _registry=Registry.getRegistry("net.rim.device.api.content.BlackBerryContentHandler"); _registry.invoke(invocation); – BurunduK Apr 28 '11 at 07:30
  • @Arhimed the invocation class is what i need but it doesn't seem to do nothing – BurunduK Apr 28 '11 at 07:37
  • @Victor I.: At a quick glance: maybe this is just because you missed one slash in the path after "file:" in `new Invocation("file://SDCard/BlackBerry/PopFax/39508844.pdf");`? Sorry, I just have no other ideas because I've never used BB Content Hand­ler API. – Vit Khudenko Apr 28 '11 at 10:09