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

Adobe AIR Development

Reply
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Enable Share button in context menu

[ Edited ]

I'm about to start my weekend, but I'll still write this, maybe it helps Smiley Happy

 

it still sounds to me like you are not adding the ANE correctly (or maybe you have no mailaccount or such? Simulator?). The file may be read in Flash CS, the file may be still compiled with, but something is still wrong

 

This is a simple class, which has a single static call 'invoke'

 

import flash.utils.ByteArray;
import qnx.invoke.*;


public class InvokeShare {
    public static function invoke():void {
        var byteData:ByteArray = new ByteArray();
        byteData.writeUTFBytes("Share me!");

        var request:InvokeRequest = new InvokeRequest();
        request.mimeType = "text/plain";
        request.target = "sys.bbm.sharehandler";
        request.action = InvokeAction.SHARE;
        request.data = byteData;

        InvokeManager.invokeManager.invoke(request);
    }
}

 

I know it looks like the classes jdolce wrote, and I know it looks like the example code. Simply - because it is

 

 

WHAT YOU SHOULD DO:

 

- create a new empty project with ALL 4 standard ane's

- add a button to the gui, add code in different class

- onClick -> call static function

 

If it works -> you did import the ane's correctly, the error is somewhere else

If not -> we need more information, most likely your code + app.xml + bar-descriptor (shortened to the necessary information)

 

 

also, a question I forgot to ask: what device are you testing on?

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 239
Registered: ‎03-14-2012
My Device: PlayBook 2.0
My Carrier: AT&T

Re: Enable Share button in context menu

That works! Thanks!! Smiley Happy

 

Noq I only need to get the SHARE button in the context menu to show up. 

I have a textfield where I would like to share the selected text via the SHARE context menu button.

 

I tried this code but the SHARE button is not showing up:

import qnx.events.InvokeEvent;
import qnx.invoke.*;

import qnx.fuse.ui.core.InvokeActionItem;
import qnx.fuse.ui.core.ActionSet;
import qnx.fuse.ui.core.ActionBase;

import flash.utils.ByteArray;



var ba:ByteArray = new ByteArray();
ba.writeUTFBytes("Some text to share");

var openapp:Button = new Button();
var invokeItem:InvokeActionItem = new InvokeActionItem(null,"text/plain",null,ba);
var actionSet:ActionSet = new ActionSet(new <ActionBase>[invokeItem]);
var actions:Vector.<ActionSet> = new <ActionSet>[actionSet];

openapp.contextActions = actions;

addChild(openapp); 

 Any ideas or other examples I could try?

Highlighted
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Enable Share button in context menu

for the context menu, I answered you in the other thread

 

http://supportforums.blackberry.com/t5/Adobe-AIR-Development/Context-Menu-troubles-performance-getti...

 

If my invoke-code worked, then just rewrite it to

invoke(message:String)

 

and pass the text of your textfield to that function

 

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o