Call the JavaScript file java class in the native blackberry development.


What you are looking for is the ScriptableFunction class.

You can extend the script engine of a JavaScript object name to a ScriptableFunction Java class mapping.  In this example, if you called foo. JavaScript bar(), the BrowserField would facilitate a call to the invoke() method defined in the MyScriptableFunction() class:

protected BrowserField _browserField   = null;
_browserField = new BrowserField();
_browserField.extendScriptEngine("foo.Bar", new MyScriptableFunction());

Then you set your ScriptableFunction class like this and fill it with some Java code, you need.  Note: it only accepts strings as input parameters.

import net.rim.device.api.script.ScriptableFunction;

/**
 * @description Demonstration of using the ScriptableFunction class added to version 5.0 of the BlackBerry Device
 *              Software
 * @version 1.0
 * @author Adam Stanley, Developer Relations
 * @category BlackBerry BrowserField Development: ScriptableFunction API
 * @see http ://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/script/ScriptableFunction .html
 */

/**
 * This class can be used to represent a function in the JavaScript environment.
 */
public class MyScriptableFunction extends ScriptableFunction
{

    /**
     * User has invoked this ScriptableFunction from the JavaScript engine This example shows how to open the Messages
     * application and create a new message
     */
    public Object invoke(Object obj, Object[] args) throws Exception
    {
        if (args.length == 3)
        {

            String param1 = args[0].toString();
            String param2 = args[1].toString();
            String param3 = args[2].toString();

            //Do something
        }
        return Boolean.TRUE; //Always
    }

}

Hope that helps.

Tags: BlackBerry Developers

Similar Questions

  • How to display any type of file by invoking the native blackberry application?

    Hi all

    I want to apply that store the file name with filepath. When I click on that this file must be opened with application native blackberry.

    For an example, I have a file which is testword.doc and it stores in my memory card. I show this file on the button name. When I click on who touches this doc must be opened in the blackberry application...

    Will you please help me, how to open this file in blackberry native Application?

    Thank you in advance

    Neeraj Chauhan

    You can use the api for that call. Here is a code:

    Invocation of the invocation = new Invocation (fileUri);
    invocation.setAction (ContentHandler.ACTION_OPEN);
    The Registry = Registry.getRegistry (getClass () .getName ());
    Registry.Invoke (invocation);

    You can probably find a few samples, recently saw an article about it.

  • A few questions for the first blackberry development

    Hello

    First of all, my apologies for this being placed in the Java section, it seemed, the nearest section of what it is, but please move if need be.

    We have an application in development for the iOS platform that uses some geolocation and Web services.  We believe that we should have a version for the blackberry also platform, so we're looking in this evolution.  However, not being not to developers or users of blackberry, the different options for creating an application are quite overwhelming.  My questions are the following:

    (a) what language (Java?) is the most compatible?  Ideally, we would like to write the backend once, don't have to change the interface for devices of the curve through to the new playbook.  Java is also based on all of these devices?  None of us have any idea of Adobe Air, this is probably out of the question.

    (b) what are the operating systems are supported by what?  The curve I picked up seems to have Blackberry OS5 on it.  All operating systems support Java everything too, and whose support wifi location and cell tower map (the curve does not have a GPS unit).

    (c) I understand that during the development in Java there is a blackberry UI api, that's fine.  However, what version of Java is supported?  Is - this SE6, or we are talking about mobile Java here?

    (d) distribute the Apps.  The Blackberry App World seems to be the best route.  Do most people use?  It seems that the Blackberry is not restricted like iOS devices in how applications can be distributed.  Is there any other App stores (e.g. Amazon for Android?).  I guess it would be silly not not to enumerate the BB App World.

    Thanks in advance, any help is much appreciated.

    S.

    It is a really difficult game of questions.

    (a) Yes is the short answer.

    The long answer involves noting that the PlayBook does not directly support Java, and development platforms only available to this end are currently Adobe Air and Web works.  I can't give you a good explanation, since I dabbled only in them, but in summary,

    (a) with Web works you are essentially creating a Web application using HTML and JavaScript, with some JavaScript interfaces to the native operating system

    (b) air seems to me be in another development environment where screens and treatment are defined in a "Scripting" language that runs on the device.

    Work Web development is possible on the current BlackBerry phones as well, although I have no idea how compatible the two are - in other words how much you would have to change to a PlayBook Web app works works on the Palm and vice versa.

    I suggest you ask a similar question in the forums for these two platforms and see what they say.

    Anyway, there is a train of thought that phones current based Java will stop at some point, and phones will become based QNX, as PB.  So right now, if you want to learn something, then Web works.  But the works Web will be able to do what you want?  I don't know, but I don't know that Java is.

    But whatever the customer, you should be able to write the backend once.  Everything should speak http towards it.

    (b) there is not a BONE by device. Most devices come out with only one level and can be upgraded, usually at the next big release.

    Take a look at this good:

    http://us.BlackBerry.com/developers/choosingtargetos.jsp

    OS 5.0 in theory supports the location of the cell tower.  I say in theory because I never had to work in the United Kingdom.  But I have not tried very hard.  In my view, WiFi is available in the OS 6.0.

    (c) blackBerry support J2ME, with a significant number of extensions.  Think of it as Java 1.4 without all the useful bits, but the then RIM tried to add their useful in bits.

    (d) cannot speak for others, but BB App World is all I use.  Tried another one and didn't get anywhere.  YMMV.

    I hope this helps.

  • Implementation error when you call the native application to view Document.

    Hi all

    I have a list of documents that are in my server. Now, I want to open these documents as pdf, txt, doc, ppt, etc..

    For this I do it like this:

    When the user will trigger a line any list I download the particular document in my camera, and when it downloads successfully I'm passing it's respective device path to the app to view native document as pdf Adobe Reader and the other DocToGo.

    For the pdf files, it works fine, but for all the rest files that is showing the error that is fixed in the screenshots.

    Then please tell me why this error is coming.

    Thanks in advance.

    I found the solution.

    I did mistake when setting the target.

  • What are the concepts that we should brush upward in java to be a good blackberry developer

    Hi, if I am not new to java and blackberry, but I don't know where to start when an advanced blackberry application is given to me to develop I feel like that because maybe I need to brush the concepts in java more carefully, cannot therefore a whole list important concepts I should know inorder to write any application for blackberry.

    For me, this could be the list:

    (1) thread

    (2) networking

    (3) vector and manipulation of tables

    (4) exception management

  • Call the native browser blackberry OS6 does not work when you use this line Browser.getDefaultSession () .displayPage (url);

    Hello

    I need to invode a native browser showing a Web site using the code below

    Browser.getDefaultSession () .displayPage (url);

    She works in OS5, but does not work for the OS6. Please, someone knows how to solve this problem, too much to guide me

    regards + thank you

    codemobiles.com

    Oh, thanks for your response. (the browser is not called, there is nothing happen)

    Hoowever, the problem is resolved. That's my problem forget to add the "http://" in the url.

    regards + thank you

  • Need to call the PL/SQL Package in the group dynamics of approval class that implements IDynamicApprovalGroup

    Hi all

    This is regarding the approval of invoice AP I need in my project where the user selects the users/people approval when creating the invoice based on logic. There may be any number of users who could be part of the approval group.

    Approval users information is stored in a table with a single Bill.

    When the user initiates invoice approval, approval of the Bill should go to all the people/users selected in the invoice.

    I created the dynamic of approval group which is the result of a java class. This java class implements IDynamicApprovalGroup. (what is the oracle Developer Guide).

    I called PL/SQL to java class package to get all the details of users of custom for the current invoice table.

    I used the DriverManager.getConnection method by hard coding (JDBC URL, Username, Pwd) connection details that works perfectly fine.

    But I don't want to hard-code the connection details because it will change in bodies SIT/UAT/PROD.

    Please ask you to guide me if there is no solution for the information of connection without hard coding it.

    Following code used to get the connection details

    try {}

    Class.forName ("oracle.jdbc.driver.OracleDriver");

    System.out.println ("= class loaded");

    }

    catch (ClassNotFoundException ex) {}

    System.out.println ("= class loading error");

    ex.printStackTrace ();

    }

    Fitting out = null;

    CallableStatement cstmt = null;

    Try

    {

    connection = DriverManager.getConnection ("jdbc:oracle:thin:@xxhostname:1521/SID", "FUSION", "*");

    Connection = GetConnection ();

    System.out.println ("= connection =" + connection);

    prepare the call

    cstmt = connection.prepareCall ("{call XX_AP_INV_DYN_APPROVAL_PKG. {GET_GROUP_PARTICIPANTS (?,?)} ») ;

    cstmt.setString (1, '12345');   ID on invoice

    Exit of the register

    cstmt.registerOutParameter (2, java.sql.Types.VARCHAR);

    Call the stored procedure

    cstmt. Execute();

    System.out.println ("= procedure being executed");

    approvalGroupMembers = cstmt.getString (2).split("#");

    System.out.println ("= output:" + cstmt.getString (2));

    }

    catch (Exception ex) {}

    ex.printStackTrace ();

    }

    Finally

    {

    Try

    {

    If (cstmt! = null)

    close the callable statement

    {

    cstmt. Close();

    cstmt = null;

    }

    System.out.println ("= stmt closed");

    }

    catch (SQLException ex)

    {

    System.out.println ("= stmt close err");

    ex.printStackTrace ();

    }

    Try

    {

    If (connection! = null)

    close the connection

    {

    Connection.Close;

    connection = null;

    }

    System.out.println ("= closed conn");

    }

    catch (SQLException ex)

    {

    System.out.println ("= Close conn err");

    ex.printStackTrace ();

    }

    }

    Thank you

    Dipak.

    HI Dembélé - you should be able to call the provider database from the java class. Documentation is here. However, you need to specify the name of the data provider that is the same in all environments. Do you know what it is? If it's not I'll take a look and get back to you.

    __

    Peter Maurer

    Relationship with the developers of Applications in fusion

    https://blogs.Oracle.com/fadevrel/

  • using the native image viewer

    IST is possible to invoke the native image viewer of my application to display pictures?

    When I send a jpg file on my device by email, I can see it. Then I have different options on the menu as zoom, fit to the screen, etc...

    I would use this native Viewer on my application.

    Thanks for help.

    Anil

    The following code calls the native image viewer

    BrowserSession b = Browser.getDefaultSession();b.displayPage(path+imageName);
    

    Thank you!

  • Trigger the native code in WebView - Invocation?

    Hello

    I have a WebView inside my application and trigger the native code on certain events in the Web view. In iOS or Android, I would like to make a call to a URI (myapp://dothisfunction) and I as regged of URI in the app. But is it possible in 10 BB? What is the alternative?

    / Johan

    Just the handle NavigationRequested cascading. Or call the native side of JS using navigator.cascades.postMessage () and the managing of messageReceived. No need for the URL custom or the framework Invoke.

  • With the help of Cloud Connector to replace the native integration of SFDC of Eloqua

    I was discussing an idea today and I want to run it by the community here to get feedback and validation.

    We have a customer wants to integrate their instance Eloqua with a CRM unsupported by Eloqua.

    The customer likes the idea and the logic of the program generator and copy the programs that come by default with any which Eloqua instance for integration with SFDC.

    The clinet will build a service bus to manage the integration between their CRM and Eloqua.

    The question here is can the stages of the program changed to call their internal service bus using the cloud connector (ExternalService) instead of calling the natives calls SFDC integration event?

    I assume here they will build different methods in their bus server to manage create leads and contacts and update leads and contacts similar to event integration calls.

    Also here I'm not talking about the auto-synch functionlaity I just need to check out this concept and see if anyone already implmeneted before or not.

    Also, if anyone has problems with it let me know I would like to cover all the bases before going with this idea.

    I think that theoretically it should work without any problems and it is a big plus to take advantage of the use of the program generator to control the flow of the integration logic.

    Kind regards

    Nader

    The question you ask is:

    Can I use generator program and custom integrations to CRM cloud connectors.  Effectively, you need to replace the native integration API steps with no cloud to your program/middleware.

    The quick answer is Yes.   The thing to know is the number of steps (API has a limit of simultaneous connection 5 hard) and the number of API calls.   You would like to make an analysis of the frequency and volume of lead and contact updates to CRM in order to determine whether it is the right solution.  Based on the frequency and the volume you need business logic to live outside of Eloqua.  Using a middleware like Informatica product allows to build it in a workflow environment and you allows to exploit the DTS WSDL (E9) allows a high volume of documents.

    Cheers, Aaron.

  • Error on Java class calling in the Oracle database

    I have a java class indicated below:

    /*

    * To change this license header, choose license headers in the project properties.

    * To change this template file, choose Tools | Templates

    * and open the template in the editor.

    */

    package oracletree1;

    import java.sql.Connection;

    to import java.sql.DriverManager;

    import java.sql.ResultSet;

    import java.sql.SQLException;

    import java.sql.Statement;

    /**

    *

    * @author oracle

    */

    public class TREEUPDATER {}

    int levels;

    int NodeId;

    int ParentId;

    String FatherID;

    int ChildBed_new;

    int ChildBes_new;

    int ChildMande_new;

    int ChildBed_old;

    int ChildBes_old;

    int ChildMande_old;

    int ParentBed;

    int ParentBes;

    int ParentMande;

    Script string;

    String ValueState;

    String TreeState;

    Public TREEUPDATER() throws SQLException {}

    }

    public void update (levels int, int NodeIds, int childBed_old, int childBes_old, int childMande_old) throws SQLException {}

    This. ChildBed_old = childBed_old;

    This. ChildBes_old = childBes_old;

    This. ChildMande_old = childMande_old;

    This. Levels = levels;

    This. NodeId = NodeIds;

    String [] array;

    try {}

    Class.forName ("oracle.jdbc.driver.OracleDriver");

    } catch (ClassNotFoundException e) {}

    System.out.println ("where is your Oracle JDBC Driver?');

    return;

    }

    System.out.println ("Oracle JDBC Driver registered!");

    Fitting out = null;

    try {}

    connection = DriverManager.getConnection)

    "jdbc:oracle:thin:@192.168.1.12:1521:orcl", "tree1"

    'oracle');

    } catch (SQLException e) {}

    System.out.println ("connection failed! Check the console output");

    return;

    }

    If (connection! = null) {}

    Statement stmt = connection.createStatement ();

    Instruction stmt2 = connection.createStatement ();

    stmt.executeUpdate ("insert into test.java_test (id) values (21)" ");

    ResultSet rs = stmt.executeQuery ("SELECT * from value" + "where nodeid =" + NodeId);

    ResultSet rs2 = stmt.executeQuery ("select * from tree where id =" + NodeId);

    While (RS. Next {}

    This. FatherID = rs2.getNString("FatherID");

    This. ChildBed_new = rs2.getInt ("bed");

    This. ChildBes_new = rs2.getInt ("bes");

    This. ChildMande_new = rs2.getInt ("control");

    table = new String [100000];

    Table = FatherID.split ("_");

    for (int i = 0; i < array.length; i ++) {}

    ResultSet rs3 = stmt2.executeQuery ("SELECT * from tree" + "where id =" + array [i]);

    This. ParentId = rs3.getInt ("id");

    This. ParentBed = rs3.getInt ("bed");

    This. ParentBes = rs3.getInt ("bes");

    This. ParentMande = rs3.getInt ("control");

    connection.setAutoCommit (false);

    ParentBed = ChildBed_new - ChildBed_old;

    ParentBes = ChildBes_new - ChildBes_old;

    This. TreeState = rs2.getNString ("state");

    If (TreeState.equalsIgnoreCase ("BED")) {}

    This. ParentMande = ParentBed - ParentBes;

    } else {}

    This. ParentMande = ParentBes - ParentBed;

    }

    This. Script = ("update the bed = bed set value +" + ParentBed + "and bes = bes +" + ParentBes + "and control = control +"+ ParentMande ")

    + ' where id = "+ ParentId);»

    stmt2. ExecuteUpdate ("" + Script);

    }

    }

    }

    }

    }

    I have a main class, which show below:

    /*

    * To change this license header, choose license headers in the project properties.

    * To change this template file, choose Tools | Templates

    * and open the template in the editor.

    */

    package oracletree1;

    import java.sql.SQLException;

    /**

    *

    * @author oracle

    */

    public class OracleTree1 {}

    /**

    @param args command-line arguments

    */

    Public Shared Sub main (String [] args) throws SQLException {}

    TODO logical application of the code here

    TREEUPDATER t = new TREEUPDATER();

    }

    }

    I was responsible for these classes in oracle database 11 g 2 and I want to use a trigger to execute the updating() method. If I created a procedure like this:

    CREATE OR REPLACE PROCEDURE REPORT4

    (

    LEVELS IN NUMBERS

    NODEID NUMBER

    CHILDBED_OLD NUMBER

    CHILDBES_OLD NUMBER

    CHILDMANDE_OLD NUMBER

    ) AS

    Name of the java LANGUAGE "TREEUPDATER.updating (1,2,3,4,5);

    But when I want to compile and run this procedure, I get this error:

    Error: PL/SQL: analysis of completed Compilation unit

    Error (9,16): PLS-00311: the declaration of 'TREEUPDATER.updating' (1,2,3,4,5) is incomplete or incorrect

    Can any one solve this?

    Thank you

    The correct syntax for PORCEDURE4 is:

    No it's not. I already gave the correct syntax, which apparently ignored you.

    I don't know how can pass these parameters to this method.

    My question is clear?

    It is clear that you are interested in reading the documentation. All the answers are there.

    You're mixing two things:

    (1) creating the procedure (once), and I already told you how to do it

    (2) the procedure call

    For 1)-do you only once :

    CREATE OR REPLACE PROCEDURE REPORT4)

    LEVELS IN NUMBERS

    NODEID NUMBER

    CHILDBED_OLD NUMBER

    CHILDBES_OLD NUMBER

    CHILDMANDE_OLD NUMBER

    )

    AS

    JAVA LANGUAGE

    NAME of ' oracletree1. TREEUPDATER.updating (int, int, int, int, int)';

    For 2)-procedure call:

    ...

    BEGIN

    ... of the code

    -you call proc with your real settings:

    procedure4 (v_levels, v_nodeid, v_childbed_old, v_childbes_old, v_childmande_old);

    ... rest of your code

    END;

    Pay attention to remarks from other institutions.

  • How to download a java class of database to the file system

    Hi all
    We have an invalid java class into the database. To check what is the functionality of this class. So, we planned to download this class for the file system. Then we decompile the source. But we are not able to identify the correct command to download the java database class.


    Please suggest me if any possible ways to achieve this.

    Thanks in advance...

    http://www.SQL.ru/Forum/actualthread.aspx?TID=747308
    http://download.Oracle.com/docs/CD/B19306_01/Java.102/b14187/AppendixA.htm

    PROCEDURE export_source (name VARCHAR2, VARCHAR2 schema, blob BLOB)
    PROCEDURE export_class (name VARCHAR2, VARCHAR2 schema, blob BLOB)
    PROCEDURE export_resource (name VARCHAR2, VARCHAR2 schema, blob BLOB)

    create table scott.t (id number, b blob);
    
    declare
        b blob;
        begin
    
           dbms_lob.createTemporary(b, true, dbms_lob.CALL);
           dbms_java.export_class('sun/net/www/ParseUtil', user, b);
          dbms_output.put_line('length(b): '||length(b));
    
          insert into "SCOTT"."T" values(1,b);
        end;
    
  • Flash cannot call the javascript function in the local html file

    Hello!

    Us is to develop our first application on Playbook. It is an html file including a flash file and javascript code. Everything is packed in. in the file bar, a config.xml file and has been correctly loaded into the Playbook. Everything works locally (no web access)

    Everything works well except when we use an ExternalInterface.call("saveglobalscore",score) in flash that calls a javascript function in the .html file.

    In the actionscript3, we selected the "authorized local file access" and put the 'Security.allowDomain("*) '.

    Any ideas? Thank you!

    External interface tries to access the files packaged locally is currently a known issue.  I have not really of a calendar when or if this can be resolved.  It may be in the code base of flash.

  • How to call the java function with javascript setting in mobile adf?

    How to call the java function with javascript setting in mobile adf?

    The ADF Mobile utility container API can be used from JavaScript or Java.

    Application container API - 11 g Release 2 (11.1.2.4.0)

  • How to write several unique java class in the java file?

    Hello
    I use Jdev 11.1.2.0.0.

    When I write the java class, I wrote in my file of multiple class. This time Jdeveloper advise that, move this class into distinct java file.
    But I don't want to go, without moving this class it works perfectly. But it is what tells the error indicator 'red '. How to solve this problem.

    Kind regards
    Rami

    Hello

    its an audit rule that is facing you. You can go to tools-->--> Audit preferences and disable it if you are more disturbed.

    Frank

Maybe you are looking for