How to pass an argument of javascript to java extension

Hello, I have an application running with a Java Extension.

For the course of time, I only call some java extension methods (ScriptableFunction, but now, I have to pass the variable javascript (arguments) to the extension.

I call a method with:

// In: public final class MyCamera extends ScriptableFunction

public Object getField(String name) {

    if (name.equals("getImage")) {
     return callGestorCamera.pushUICameraSnapshot();
    } 

    return new String("do nothing");
}

and javascript :

function getImage() {
    var name = mycamera.camera.getImage;
    return name;
}

and run correctly.

But now I have to pass one argument, as some URL, and I don't know how to do.

I try to move the handful of Java class to Javascript, something like this:

// In: public final class MyCamera extends ScriptableFunction

public Object getField(String name) {

    if (name.equals("getImage")) {
     return callGestorCamera.pushUICameraSnapshot();
    } 

    if (name.equals("getObject")) {
     return callGestorCamera;
    }

    return new String("do nothing");
}

and javascript :

function setUrl(url) {   var handle = mycamera.camera.getObject;        handle.setUrl(url);

    return true;}

but is not running and try:

mycamera.camera.getObject.setUrl(url);

but does not work.

What is the way?

Thank you!

I believe that the Extensions lab shows how to pass a parameter to a function... For example, he spends the duration of the vibration.

http://NA.BlackBerry.com/eng/developers/devbetasoftware/Lab_Widget_Extension.zip

Tags: BlackBerry Developers

Similar Questions

  • How to pass an argument to a standalone java class JDeveloper

    For the experienced:

    In JDeveloper when you write a java class with a main() method that takes no arguments, you just click with the right button on the java file and choose run to run the program. But suppose the main() method takes arguments, how to move your arguments to the program? This is especially a problem I use the studio version of JDeveloper (10.1.3.4 and 11.1.1.3 Versions) that each uses the version of the JDK included with, rather the JDK (which is yet another different version) installed at the level of the OS on the PC.

    Thanks a lot for your help!


    Newman

    Hello

    If you mean how to pass arguments in JDeveloper:
    Tools > Project Properties > run/debug > change the default run Configuration (or create a new) > settings start > program Arguments - here you can set arguments

    Kind regards
    Branislav

  • How to passing arguments to an exe

    Hai Everbody

    I know that LabVIEW has the ability to call an exe file created in different platform, can I know how to pass arguments to the special exe (which is located in another platform) via LabVIEW... I wish someone could help me out of this

    Thanks for your answers, I found the solution... As the exe is in .net, I used the syntax for the command line arguments in .net...

  • How to pass arguments to JVM containing spaces on Solaris

    How to pass the value of the JVM Argument containing spaces on Solaris?

    For example, I need to run tests of cucumber and pass the following JVM argument:

    -Dcucumber.options = "features - classpath:com glue, company, projects, steps"

    But I get the following error:

    Unrecognized option:-glue

    Could not create the Java virtual machine.

    Seems that the space after "features" is recognized as a delimiter, even if I put the value in quotes.

    Everything works fine on Windows, but fails on Solaris 5.10.

    Any ideas?

    Thank you.

    Problem is solved. The cause was illogical in quotes in Shell.

    This does not work, she same product works the same string on Windows:

    CUCUMBER_OPTIONS = "-Dcucumber.options =-" $FEATURES_PATH - fit $STEPS_PATH\ "" "

    JVM_OPTIONS = "$CUCUMBER_OPTIONS $OTHER_OPTIONS".

    $JAVAHOME/bin/java org.junit.runner.JUnitCore com.company.project.runner.TestRunner $JVM_OPTIONS

    While this is the case, even the value $FEATURES_PATH-$STEPS_PATH glue is not quoted:

    CUCUMBER_OPTIONS = "glue-Dcucumber.options = $ FEATURES_PATH-$STEPS_PATH.

    JVM_OPTIONS = $OTHER_OPTIONS.

    $JAVAHOME/bin/java '$CUCUMBER_OPTIONS' $JVM_OPTIONS org.junit.runner.JUnitCore com.company.project.runner.TestRunner

  • How to pass the value of the item Application Javascript function.

    Hello

    I have the JavaScript in the properties attribute of the HTML Form element

    I'm on page 1 and passing the value of the item page P1_DEPT_NO. It is perferctly working very well and I am able to get the exact value of the element on the page
    onchange="javascript:function1($x('P1_DEPT_NO').value);"
    I'm on page 1 and passing the value G_DEPT_NO of the Application element .
    The problem here is, I don't get the point of Application inside the javascript function value.
    I tried to use alert(); and it gives me the undefined value
    onchange="javascript:function1($x('G_DEPT_NO').value);"
    I just want to know, How to pass the value of the Application in Javascript element.

    Thank you
    Deepak

    Deepak,

    I'm not a Javascript expert, but the suggestin I did was because the javascript is a case-sensitive... language and thats why onChange is not the same thing as onchange.
    Not sure if this is causing the problem.

    Application elements not associated with a page and have therefore no properties user interface.
    So, as mentioned in another post, the rendering would not work for the elements of the application.
    If it is for a single item, used only on this page, you might create a hidden page element and use it fo your goal

    If you want to keep watching objects application and AJAX, this page contains examples of using AJAX to solve problems like the one you mentioned.
    http://www.Oracle.com/technology/OBE/hol08/apexweb20/ajax_otn.htm#T1B

    Thank you
    Rajesh.

  • How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.

    How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.

    I s generic SOAP example/tutorial on my blog: get a serial number in a form using SOAP - KHKonsulting LLC

    The web service uses only a single parameter, but you should be able to adapt the code to two arguments without problems.

  • How to pass an xml CDATA in the string element when OSB call a webservice?

    How to pass an xml CDATA in the string element when OSB call a webservice?

    I have a business service (biz) this route to exploitation of a Web service.

    An example of this legacy Web service request:
    < soapenv:Envelope xmlns:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns: ex = "example" >
    < soapenv:Header / >
    < soapenv:Body >
    < ex: run >
    < ex: arg > <! [CDATA [< searchCustomerByDocumentNumber >
    < documentNumber > 12345678909 < / documentNumber >
    [[< / searchCustomerByDocumentNumber >]] > < / ex: arg >
    < / ex: run >
    < / soapenv:Body >
    < / soapenv:Envelope >

    type ex: arg is a string.

    How to pass this structure CDATA webservice in OSB?

    Steps to resolve this problem:
    1 create an XML schema. For example:


    elementFormDefault = "unqualified" >


              
                   
                        
                             
                             

                        

                        
                             
                        

                   

         

         

         
         

    With this XSD, XML can be generating:


    documentNumber

    2 create an XQuery query to create a ComplexType searchCustomerByDocumentNumber. For example:
    (: pragma bea: element global-element-return = "searchCustomerByDocumentNumber" location = "searchCustomerByDocumentNumber.xsd" ::))

    declare namespace xf = "http://tempuri.org/NovoSia/CreateSearchCustomerByDocumentNumber/";

    declare function xf:CreateSearchCustomerByDocumentNumber($documentNumber_as_xs:string)
    as {(searchCustomerByDocumentNumber)}

    {$documentNumber}

    };

    declare the variable $documentNumber as XS: String external;

    XF:CreateSearchCustomerByDocumentNumber ($documentNumber)

    3. in your step in proxy pipeline add to assign the created the XQuery function call from the number of the document of your payload.
    Assign to a variable (for example: called searchCustomerByDocumentNumberRequest)

    4. create an another Transformation of XQuery (XQ) to create a request to the existing Web service. For example:
    {fn - bea: serialize ($searchCustomerByDocumentNumberRequest)}

    For more information about xquery Serialize function:
    41.2.6 fn - bea: serialize()
    You can use the fn - bea: serialize() function if you need to represent an XML document as a string instead of as an XML element. For example, you can share an XML document through an EJB interface and the EJB method takes the string as an argument. The function has the following signature:

    FN - bea: serialize($input as item()) as xs: string

    Source: http://docs.oracle.com/cd/E14571_01/doc.1111/e15867/xquery.htm

  • How to pass parameters in local html files using InDesign?

    How to pass parameters in local html files using InDesign, or how to pass info environment, such as the image, the html code is sitting on top in local html files in InDesign?  I try to use the code html-javascript, then simply pass parms to behave differently depending on where the code is placed in the folios of InDesign.  I don't know how to do it.  If I could read in some environment of the folio InDesign info by using html or javascript, which might work as well.  Please advise, thank you!

    In indesign, you can draw a box and connect the html code to display in this box, if you do it this way you don't let the application in browser.  In the control panel overlays folio, its web called overlays.

    I suggest you download Bringhursts ipad Bob application called DPS tips, it will give you a quick overview of all different overlays and basic opportunities.

    https://iTunes.Apple.com/us/app/Digital-Publishing-Suite-tips/id436199090?Mt=8

    Joe

  • How to pass variables by using the command line when starting from a native application ActionScript

    How to pass in variables or arguments to start using the command line when starting a native ActionScript application? For example, I have my app MySweetWidget call and it was compiled with Adobe AIR runtime in captivity so now I have MySweetWidget.exe.

    In the command line, I call MySweetWidget.exe and would like to pass in variables or properties of the application. I guess that these variables are read from the loaderInfo.parameters object.

    Please let me know if the Adobe AIR runtime supports passing the parameters to native execution. If so, I would like to help determine the correct format of how pass variables. So would you want to read those loaderinfo.parameters object?

    Thank you

    Jeff

    I found the answer to my own question:

    Yes, it's a feature supported. It is documented on the following page:

    http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/desktop/NativeApp lication.html #event:invoke

    When you subscribe to the event from the NativeApplication invoke it will subsequently send the event and you read the table of e.arguments object to get the start in the native application arguments.

  • How to pass parameters to a Flex application?

    I'm new to Flex programming, and I need to pass to a server
    parameter generated at my test Flex application below. Can someone show
    me a MINIMUM of HTML page size that can pass the "myname" parameter to
    my Flex application?

    Thanks in advance,

    Beard

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "creationComplete ="initVars ()">
    < mx:Script > <! [CDATA]
    [Bindable]
    public var myName:String;
    private function initVars (): void {}
    myName = Application.application.parameters.myName;
    }
    []] > < / mx:Script >
    < text mx:Label = "name:"{myname}"" / >
    < / mx:Application >

    Hello

    This docs page contains different version (more short long, static and generated) on how to pass arguments to the application through vars:

    http://livedocs.Adobe.com/Flex/3/HTML/Help.HTML?content=passingarguments_3.html

    (you simply set variable in the object that hosts your flash animation in a page, see doc linked for more details)

    Kind regards

    Peter

  • How to pass a variable to a swf file in another using the Loader?

    I'm loading a swf file from another swf using the method as follows:

    var myLoader:Loader = new Loader();

    addChild (myLoader);

    var url: URLRequest = new URLRequest ("myExternalMovie.swf");

    myLoader.load (url);

    How to pass a variable to the first SWF in the second?

    I'm not sure that "passage" is a term there, given that this generally applies to what happens with functions that can host variables to pass as arguments in the.

    When using the charger, you can assign an event listener to determine whether the activity of loading is complete and have an event handler that targets its contentLoaderInfo property to the event.currentTarget.content, which in your case would be the loaded swf file.  At this point, you can assign a value to a variable in this swf file by targeting...

    var myLoader:Loader = new Loader();

    addChild (myLoader);

    myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, loadComplete);

    myLoader.load (url);

    var loadedSWF:MovieClip;

    function loadComplete(evt:Event):void {}

    loadedSWF = MovieClip (evt.currentTarget.content);

    loadedSWF.someVariable = ';?

    }

    It is probably possible you may also have the loaded swf the value rtrieve by targeting to the parent swf file, which would be both parents away because of the charger is the relative of the SWF loaded... unevariable = MovieClip (parent.parent) .someValue;

  • Is it possible to pass an argument to the function triggered by an event handler?

    Hi all
    Try to migrate my way of thinking in AS2 to AS3/CS4.
    OK, I have 2 buttons on the stage. Each button almost did the same thing, so I want to create a unique function, and each button calls this function even (we'll name this function 'Navigate')... However, the function will have to end up doing something different dependent on which button was clicked.
    If, previously, in AS2, I would have added the code on the buttons themselves with methods we (release) (see the SAMPLE CODE 1)

    Thus, each button calls the function efficiently navigate and transmits a different image to the function tag.
    Now, I try to recreate this feature in AS3. As you know, it (release) has been abolished (still do not know why), but we must now use event handlers, so I'll try to find a way to pass a different image to the function label argument to navigate. Currently, I can achieve that by using a switch statement to test which button has been clicked and act accordingly (see the SAMPLE CODE 2).

    In this simplistic example, this works very well, but in the real world, I have more than 2 buttons and the function navigate would probably much more complicated...
    So I would be able to pass an argument (as in the AS2 example) to the function to navigate... maybe in the addEventListener() method? I tried, but got compile errors (see the EXAMPLE CODE 3):

    The issue of the $ 1 Million:
    Is it possible to pass/change dynamically an argument to a function that is triggered by an event listener? (Or is the event that triggered the function the only argument you have?)
    If this is not possible, I would like to hear how you people it would handle (other than to have a switch with 12 cases in there)?

    I found a few solutions that I'll post below for prosperity...

    You can create a dictionary indexed by the targets of future events and store information in there you want to associate with them. Then the Navigate function check that the dictionary to get its parameters:

    Code.
    Button1.addEventListener (MouseEvent.CLICK, navigate, false, 0, true);
    Button2.addEventListener (MouseEvent.CLICK, navigate, false, 0, true);

    var buttonArgs:Dictionary = new Dictionary();
    buttonArgs [Button1] = "FrameLabel1";
    buttonArgs [Button2] = "FrameLabel2";

    function Navigate(e:MouseEvent):void {}
    gotoAndStop (buttonArgs [e.target]);
    }

    This to me, is about the same amount of work than writing a long, but a bit more elegant switch statement, I guess.

    I had a little trouble understanding the following solution, because I did not quite understand important information about event listeners. The addEventListener () method requires a function as the 2nd argument passed to it.
    It didn't quite click on until someone reminded me: Navigate is a function... Navigate("FrameLabel1") is a callfunction...

    So by writing simply navigate, I'm not actually calling the function when calling the addEventListener method, I'm just providing the event with a reference the name listener. Then, when the listener is triggered, the listener will call (and pass a MouseEvent argument to) navigate the function.

    Conversely, by writing Navigate("FrameLabel1") as 2nd argument, the event listener trys to run the function navigate both the addEventListener method is instantiated. And, since then, in this example, the function navigate returned as ": Sub" a compilation error would occur because as I said, an event listener requires a function as 2nd argument data type. This would be essentially as written addEventListener (MouseEvent.Click, Sub, false, 0, true)
    However, there is a way to get around this... basically, instead of setting the function navigate as returning an empty data type, you define a function to return data type and then nest another function (which actually contains the actions you want to run) on the inside.

    Button1.addEventListener (MouseEvent.CLICK, Navigate ("FrameLabel1"), false, 0, true);
    Button2.addEventListener (MouseEvent.CLICK, Navigate ("FrameLabel2"), false, 0, true);

    function Navigate(myLabel:String):Function {}
    return function(evt:MouseEvent):void {}
    gotoAndStop (myLabel);
    }
    }

  • How to pass a string to a vi from a dll?

    I have a DLL that generates errors in the log. How can I display my Panel before these errors? In other words, how to pass a string from a DLL to a vi using the library to call feature?

    Thank you

    Diego

    The DLL actually allocates memory for the string? If this is the case, there should be another function to free the memory. Otherwise you won't be able to do the deallocation of LabVIEW, which means you would have to write a wrapper DLL. If you do not have the deallocation, then you will have a memory leak.

    Are you sure that the DLL is not simply wait for a buffer "of a proper size? In this case, you can simply create a U8 in LabVIEW to a size that is larger that the largest string that you expect to get.

  • How to pass the Visa Resource Name parameter to labview dll in labwindows/cvi

    Hello world

    I build a dll of labview, the prototype is: double getchannelpower (double f, uintptr_t * VISAResourceName);

    I don't know how to go from VISAResourceName to this function.

    Is it related to the ViPSession paremeter in function viOpen(REES ViSession, rn ViRsrc, ViAccessMode am, ViUInt32 ti,ViPSession vi)?

    BRs,

    lotusky

    Hey, guys:

    I figured out how to pass the parameter.

    In labview, you must replace the control of visa with string control. In this way, the generated dll function at the entrance of the string type.

    I hope this will help others!

    lotusky

  • How to pass data (more effective) autour

    Hello
    I wonder how to pass around large data around across the application.

    For example:
    1 data or data of my analog channels
    (I have a lot of screws that will process these data of waveform)
    Is it not wise to spend around analog continuous data?

    2. What if you want to process digital data?
    (I must treat these unique bits in several screws, for example,)
    security door bit, stop bit of emergency, must be treated as higher priority than screw
    input 1, selector, etc.).

    Or you have any suggestions, what type of data I should use. I have a
    global impression screw actually write these digital data in a file, then
    These files are passed around?

    3. is there a mechanism that pass around data in memory, NOT in the files?

    By far, the way the more effiecient to pass data autour is a thread.  If you are really worried about memory, then you must avoid the connection of the wire that he holds the large amount of data.  This could mean making your processes in series (one at a time) passing the data of one Subvi to another via the controls and indicators and the connector pane.

Maybe you are looking for