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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
New Developer
Farid123
Posts: 156
Registered: ‎03-02-2011

Invoking native applications!!!

Hello, 

 

I am trying to invoke the native application for MEDIA content, so  I can view the pictures in the device, and when the user selects an image, the selected one will be loaded into the application.

Well I am invoking the Media content by the following code:

 

final Registry registry = Registry.getRegistry(com.UiApp.class.getName());               

final Invocation invocation = new Invocation(null, null, BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER, false, ContentHandler.ACTION_OPEN);               

invocation.setArgs(new String[] { BlackBerryContentHandler.MEDIA_ARGUMENT_VIEW_PICTURES});

try {                        registry.invoke(invocation); } catch (Exception ex) { }

 

The Invocation opens successfully, But when pressing the menu key and holding to see the running applications, I noticed that this invoke is running in a seperate application from my app. 

 

I want to invoke the media application within my application and without having another application running. How to do that?

Thanks...

Please use plain text.
New Developer
Farid123
Posts: 156
Registered: ‎03-02-2011

Re: Invoking native applications!!!

Anyone?!?!?!

Please use plain text.
Developer
jromanoski
Posts: 90
Registered: ‎09-07-2010

Re: Invoking native applications!!!

Hello,

 

Did you solve this issue?

 

Thanks in advance,

Please use plain text.
Developer
maadani
Posts: 729
Registered: ‎05-04-2011

Re: Invoking native applications!!!

Hi @Farid123,

 

I also tried to implement this but it seems that there is no way to implement your requirement.

 

If you want to show images in your application, you will have to search the images and display (including resizing if needed) on your own.

 

There is some sample code for this but it's not perfect and run very slow (about 10-20 seconds per image).

 

Another option is to use RIM development services. The Facebook application was developed by RIM so there you can see it works great but for third parties, it's far from it.

 

E.

 

 

 

 

Please use plain text.
Developer
alishaik786
Posts: 278
Registered: ‎08-26-2011
My Carrier: Not Specified

Re: Invoking native applications!!!

[ Edited ]

If your requirement is this:

 

view the pictures in the device, and when the user selects an image, the selected one will be loaded into the application.

 

FilePicker is useful for select the picture:

 

public class Ghi extends MainScreen
{
	FilePicker filePicker;
	ButtonField select;
	byte data[];
	public Ghi() 
	{
		createGUI();
	}

	private void createGUI() 
	{
		
		select=new ButtonField("save");
		select.setChangeListener(new FieldChangeListener() 
		{
			public void fieldChanged(Field field, int context) 
			{
				callFilePicker();
			}
		});
		add(select);
		
		
	}
	
	private void callFilePicker()
	{
		synchronized (UiApplication.getUiApplication().getAppEventLock()) 
		{
			filePicker=FilePicker.getInstance();
			filePicker.setPath("file:///SDCard/BlackBerry/pictures/");//Your desired path. Before giving "setPath" check SDCRAD is present or not
			filePicker.setListener(new Listener() 
			{
				public void selectionDone(String selectedPath) 
				{
					try 
					{
						System.out.println("======================URL: "+selectedPath);
						FileConnection file = (FileConnection)Connector.open(selectedPath);
						
//						Do what ever you want. Means Take the picture in to Byte array and 
//						do something;
						
						file.close();					
					} 
					catch (Exception e) 
					{
						StartUp.exceptionHandling(e.getMessage());
					}
				}
			});
			filePicker.show();
		}
	}
}


//Here url nothing but the path up to your selected pictureName;
//if "sdcard" present then filePicker.setPath("file:///SDCard/BlackBerry/pictures/");
//else filePicker.setPath("file:///store/home/user/pictures/");

 =====================================================

Feel free to click LIKE button if the answer is correct;

============================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.