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
Developer
Iyenemi_Tyger
Posts: 132
Registered: ‎10-25-2011
My Device: Tour 9630
My Carrier: MTN

Contenthandler for native blackberry picture app

Good day everyone 

i am trying to create a module in my app that will enable the end user to click on my custombitmapfield this will activate the native picture app and allow the user to select  a picture from the app the picture will return the path to the selected file that my app will process and set on my bitmapfield as a bitmap , now i have been able to get all the processing correct .

i am using this to invoke the native picture app 

Listing 1

-----------------------------------------------------------------------------------------

Invocation invocation = new Invocation();
invocation.setID(BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER);

/** if i use  the ContentHandler below it , the picture app doesnt load at all  unless i use Contenthandler.ACTION_OPEN , i do find that funny **/
invocation.setAction(ContentHandler.ACTION_OPEN);
invocation.setArgs(new String[] { BlackBerryContentHandler.MEDIA_ARGUMENT_VIEW_PICTURES});

 

Registry _registry = Registry.getRegistry(RegisterScreen.class.getName());

/** set the listener to get response from native app **/
_registry.setListener(new ImageSelectListener());

// Invoke the content handler.
_registry.invoke(invocation);

 

End of Listing 1

----------------------------------------------------------------------------------------------------------------------------------

 

/**Ok now since i am expecting a response from the native app i have to implement a ResponseListener **/

Listing 2

--------------------------------------------------------------------------------------------------------------------------------

class ImageSelectListener implements ResponseListener
{

public void invocationResponseNotify(Registry registry)
{
Invocation response = registry.getResponse(true);
if (response.getStatus() == Invocation.ERROR)
{
System.err.println("Invocation failed");
}
else if (response.getStatus() == Invocation.OK)
{
String fileName = response.getArgs()[0];
System.out.println("Selected file " + fileName);
}
}


}

Endof listing 2

----------------------------------------------------------------------------------------------------------------------------------------------

The funny thing is the behaviour of the native app , once i click my bitmapfied the native app opens up but does not even wait for me to select apicture , it mediately returns back to my screen and returns "view-pictue-library"

I have studied all contenthandler materials  and it suprises me that it behaves funny , please i need to know how to relate with this api cause i will be needing it seriously in the life cycle of the project i am working on , thanks .

 

Please use plain text.
New Contributor
Kamix
Posts: 6
Registered: ‎07-06-2012
My Device: Blackberry 9800
My Carrier: mtc touch

Re: Contenthandler for native blackberry picture app

Hi,

 

any news about this issue?

 

i have exactly the same problem and still no solution :smileysad:

Please use plain text.
Developer
Iyenemi_Tyger
Posts: 132
Registered: ‎10-25-2011
My Device: Tour 9630
My Carrier: MTN

Re: Contenthandler for native blackberry picture app

No results yet i am using my filepicker currently as a temporary solution , i was very happy when i saw the mail , i was thinking maybe someone has solved the issue , i will battle with it later for now i have a deadline .thanks .

Please use plain text.
New Contributor
Kamix
Posts: 6
Registered: ‎07-06-2012
My Device: Blackberry 9800
My Carrier: mtc touch

Re: Contenthandler for native blackberry picture app

I had already opened a new post concerning the same issue a couple of weeks ago..Again with no solution:smileysad:

http://supportforums.blackberry.com/t5/Java-Development/Native-Media-application/m-p/1800191

 

i have mentioned their some interresting points that i noticed when checking some apps using this process.ex: the native media application is not showing as a standalone running app when pressing and holding the menu key.

 

so i was thinking that they are not using a usual invocation since it will show as a different running app.

Please use plain text.
Developer
Iyenemi_Tyger
Posts: 132
Registered: ‎10-25-2011
My Device: Tour 9630
My Carrier: MTN

Re: Contenthandler for native blackberry picture app

Yeah i think i saw your posts , i wonder what  the problem is , i woulld have believed that using ContentHandler.ACTION_SELECT will solve this issue , but it was otherwise so i only hope that it aint a rim conservative issue * lol* .

Please use plain text.