08-02-2011 08:56 AM
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_PICTU
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...
08-02-2011 09:17 AM
Anyone?!?!?!
01-05-2012 07:48 AM
Hello,
Did you solve this issue?
Thanks in advance,
01-05-2012 08:12 AM
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.
01-05-2012 08:51 AM - edited 01-05-2012 08:52 AM
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/pict ures/");//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/pict ures/");
//else filePicker.setPath("file:///store/home/user/pictur es/"); =================================================
Feel free to click LIKE button if the answer is correct;