Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
BB_AppDeveloper
Posts: 16
Registered: ‎03-22-2013
My Device: 8520,9900,9930,9330,9790,9780
Accepted Solution

How to launch Documents To Go Programmatically

Hello,

 

I am newbie at BB development. In my app I want to let user view document of type .txt ,.pdf , .doc etc.

I want to open the document using  ''Documents To Go" App which I suppose is by default in every  BB device(Since OS 6) . (Please correct me if I am wrong).

I got some info from following link.

http://stackoverflow.com/questions/2535727/launch-documents-to-go-app-from-third-party-blackberry-ap... 

 

The code given here is :

Invocation invocation = new Invocation(path);
Ragistry reg =  = Registry.getRegistry("<your app namespace.class>");
reg.invoke(invocation);

 

I am not getting what to put under <your app namespace.class> and "path" . I am not getting the full qualified path for 'Documents To Go'.

Please help.

 

Thanks in advance.

 

 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to launch Documents To Go Programmatically

welcome to the forums.

the path would be the location of the document you want to open.
your namespace is just the namespace qualifier of your app, like com.mycompany.myapp
it does not invoke DocsToGo targeted, but rather tells the system "hey, i have a doc file, can you handle that for me"

you can also see the invocation sample.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
BB_AppDeveloper
Posts: 16
Registered: ‎03-22-2013
My Device: 8520,9900,9930,9330,9790,9780

Re: How to launch Documents To Go Programmatically

Thanks Simon_hain for Quick reply..

 

 

Contributor
BB_AppDeveloper
Posts: 16
Registered: ‎03-22-2013
My Device: 8520,9900,9930,9330,9790,9780

Re: How to launch Documents To Go Programmatically

Hi Simon_Hain,

 

I have tried the way you told but I am getting the following Exception  :

 

java.lang.IllegalArgumentException : Classname is not implemented.

 

This is my code..

public class DispDoc extends MainScreen 
{
	public DispDoc()
	{
		setTitle("Use the menu to open a document");
		MenuItem menu = new MenuItem("Open File", 40, 40)
		{
			public void run()
			{
				try
				{
					//Create the invocation request.
					Invocation invocation = new Invocation("file:///SDCard/Synopsis.docx");
					invocation.setAction(ContentHandler.ACTION_OPEN);
					
					//Use the registry to perform the invocation.
					Registry registry = Registry.getRegistry("PackageName.classname.class");
					registry.invoke(invocation);
					
				}
				catch (Exception ex)
				{
					System.out.println("Exception: " +ex.toString());
				}
			}
		}; 
		addMenuItem(menu);		
	}
}

 Am I mistaking in entering class path ?

I am getting exception at  following line..

 

Registry registry = Registry.getRegistry("PackageName.classname.class");

 Please help.

Thank you.

 

 

 

 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to launch Documents To Go Programmatically

replace this with the values of your own program
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
BB_AppDeveloper
Posts: 16
Registered: ‎03-22-2013
My Device: 8520,9900,9930,9330,9790,9780

Re: How to launch Documents To Go Programmatically

Registry registry = Registry.getRegistry("com.test.doc.DispDoc.class");

 Here,

com.test.doc is my package Name and DispDoc.class is class name.