NDK Native beginning

So I'd really like to start playing with the NDK. I was not able to find any tutorials that explain basically the configuration of the space project. Someone at - it a good start tutorials that explain the processs to create your project area and explanations of the workspace?

Have you looked at: https://bdsc.webapps.blackberry.com/native/? In addition, there is a NDK forum to ask specific questions. Most of the API is oriented with old-school structures and functions of passage of 'C '. At first glance, it seems to not be very OO at all. The structure of the event is very old school, but you get close to bare metal with it.

Tags: BlackBerry Developers

Similar Questions

  • Sensor use the NDK 2.0 in a (ANE) Extension Native AIR API

    Hello

    I tried to access the gyroscope for a Native Extension of AIR, help NDK 2.0 Beta 3, Flash Builder 4.6 and Tablet OS 2.0.0.7111

    I managed to make a C simple library that I can call the air (so that I don't know that all the settings are correct), but as soon as I add a reference to the sensor.h library loads is no longer. I get the following error in the AIR:

    ArgumentError: Error #3500: the context of the extension doesn't have a method with the name of init.
    at flash.external::ExtensionContext/_call()
    at flash.external::ExtensionContext/call()
    to com.adobe.nativeExtensions::Gyroscope$/get isSupported() [/ Users/airqe/Users/sbhave/Gyroscope/AS/src/com/adobe/nativeExtensions/Gyroscope.as:106]

    ...

    My assumption is that I'm using a library which contains functions of sensor is not found, so it cannot load my library. But I can perfectly well be another problem.

    Someone has managed to make this work? Any help would be welcome.

    Thank you!

    I just added bps in libraries (-l) the GCC linker settings and it works.

    Thanks for the explanation!

  • BB10 NDK error undefined reference to 'init_JSON_config '.

    Hi all

    I'm trying to integrate json parser in my native project BB10. The codes are derived from here

    https://github.com/BlackBerry/JSON_parser/

    I copied the file JSON_parser.h and JSON_parser.c in the source directory. In the HelloCascadesApp.cpp, I have included the header file.

    Now, when you compile the project, I get error like

    no reference to 'init_JSON_config '.

    This is the output of the compiler

    **** Build of configuration Simulator-Debug for project another ****
    
    make Simulator-Debug
    d:/bbndk-10.0.4-beta/host/win32/x86/usr/bin/qmake -spec unsupported/blackberry-armv7le-g++ -o arm/Makefile another.pro CONFIG+=device
    d:/bbndk-10.0.4-beta/host/win32/x86/usr/bin/qmake -spec unsupported/blackberry-x86-g++ -o x86/Makefile another.pro CONFIG+=simulator
    make -C ./translations -f Makefile update release
    make[1]: Entering directory `C:/ndk-10.0.4-workspace/another/translations'
    d:/bbndk-10.0.4-beta/host/win32/x86/usr/bin/lupdate another.pro
    Updating 'another_en_GB.ts'...
        Found 0 source text(s) (0 new and 0 already existing)
    Updating 'another_fr.ts'...
        Found 0 source text(s) (0 new and 0 already existing)
    Updating 'another_it.ts'...
        Found 0 source text(s) (0 new and 0 already existing)
    Updating 'another_de.ts'...
        Found 0 source text(s) (0 new and 0 already existing)
    Updating 'another_es.ts'...
        Found 0 source text(s) (0 new and 0 already existing)
    Updating 'another.ts'...
        Found 0 source text(s) (0 new and 0 already existing)
    d:/bbndk-10.0.4-beta/host/win32/x86/usr/bin/lrelease another.pro
    Could not find qmake configuration directoryCould not read qmake configuration file D:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/qmake.confUsing OS scope before setting MAKEFILE_GENERATORD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/debug_and_release.prf(1): Using OS scope before setting MAKEFILE_GENERATORD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(4): Using OS scope before setting MAKEFILE_GENERATORD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(36): Using OS scope before setting MAKEFILE_GENERATORD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(197): 'qtAddLibrary' is not a recognized test functionD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(197): 'qtAddLibrary' is not a recognized test functionD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(197): 'qtAddLibrary' is not a recognized test functionD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(197): 'qtAddLibrary' is not a recognized test functionD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(197): 'qtAddLibrary' is not a recognized test functionD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(197): 'qtAddLibrary' is not a recognized test functionD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(197): 'qtAddLibrary' is not a recognized test functionD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/qt.prf(213): Using OS scope before setting MAKEFILE_GENERATORD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/moc.prf(3): 'qtPrepareTool' is not a recognized test functionD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/moc.prf(12): Using OS scope before setting MAKEFILE_GENERATORD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/moc.prf(97): Using OS scope before setting MAKEFILE_GENERATORD:/bbndk-10.0.4-beta/target/qnx6/usr/share/qt4/mkspecs/features/uic.prf(108): Using OS scope before setting MAKEFILE_GENERATORThe directory name is invalid.
    Updating 'C:/ndk-10.0.4-workspace/another/translations/another_en_GB.qm'...
        Generated 0 translation(s) (0 finished and 0 unfinished)
    Updating 'C:/ndk-10.0.4-workspace/another/translations/another_fr.qm'...
        Generated 0 translation(s) (0 finished and 0 unfinished)
    Updating 'C:/ndk-10.0.4-workspace/another/translations/another_it.qm'...
        Generated 0 translation(s) (0 finished and 0 unfinished)
    Updating 'C:/ndk-10.0.4-workspace/another/translations/another_de.qm'...
        Generated 0 translation(s) (0 finished and 0 unfinished)
    Updating 'C:/ndk-10.0.4-workspace/another/translations/another_es.qm'...
        Generated 0 translation(s) (0 finished and 0 unfinished)
    Updating 'C:/ndk-10.0.4-workspace/another/translations/another.qm'...
        Generated 0 translation(s) (0 finished and 0 unfinished)
    make[1]: Leaving directory `C:/ndk-10.0.4-workspace/another/translations'
    make -C ./x86 -f Makefile debug
    make[1]: Entering directory `C:/ndk-10.0.4-workspace/another/x86'
    make -f Makefile.Debug
    make[2]: Entering directory `C:/ndk-10.0.4-workspace/another/x86'
    qcc -Vgcc_ntox86 -lang-c++ -Wl,-rpath-link,d:/bbndk-10.0.4-beta/target/qnx6/x86/lib -Wl,-rpath-link,d:/bbndk-10.0.4-beta/target/qnx6/x86/usr/lib -o o-g/another o-g/.obj/hellocascades.o o-g/.obj/HelloCascadesApp.o o-g/.obj/moc_HelloCascadesApp.o  -lcurl  -Ld:/bbndk-10.0.4-beta/target/qnx6/x86/lib -Ld:/bbndk-10.0.4-beta/target/qnx6/x86/usr/lib -Ld:/bbndk-10.0.4-beta/target/qnx6/x86/usr/lib/qt4/lib -LD:/bbndk-10.0.4-beta/target/qnx6/x86/usr/lib/qt4/lib -lm -lbps -lbb -lQtCascades -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lQtXmlPatterns -lQtXml -lQtGui -lQtNetwork -lQtCore
    Could not find qmake configuration directoryCould not find qmake configuration fileUsing OS scope before setting MAKEFILE_GENERATORo-g/.obj/HelloCascadesApp.o: In function `parse_JSON':
    C:\ndk-10.0.4-workspace\another\x86/../src/HelloCascadesApp.cpp:216: undefined reference to `init_JSON_config' C:\ndk-10.0.4-workspace\another\x86/../src/HelloCascadesApp.cpp:224: undefined reference to `new_JSON_parser'
    cc: d:/bbndk-10.0.4-beta/host/win32/x86/usr/bin/ntox86-ld caught signal 1
    make[2]: *** [o-g/another] Error 1
    make[2]: Leaving directory `C:/ndk-10.0.4-workspace/another/x86'
    make[1]: Leaving directory `C:/ndk-10.0.4-workspace/another/x86'
    make[1]: *** [debug] Error 2
    make: *** [Simulator-Debug] Error 2
    
    **** Build Finished ****
    

    I used this parser json beginning of NDK 2.0 BB with no problems.

    Can someone help me?

    concerning

    by default, the c files are ignored, add, change your {appname} .pro

    and add the singel file:

    SOURCES += ../src/*.cpp ../src/JSON_parser.c
    

    or all the *.c files:

    SOURCES += ../src/*.cpp ../src/*.c
    
  • UI on Macbook Pro 2015 trolling in the native resolutions

    I have a really strange problem with my Macbook Pro 15 beginning 13 "retina. The user interface is a little laggy when I put any native resolution, that the system provides. For example, when I opened this page: http://www.apple.com/iphone-6s/ , animations are visibly restless. But as soon as I put the resolution to a value of system supported (2048 x 1280 for example) some not all works well and that it should. Another weird thing - if I move a browser window of my laptop to an external monitor Full HD screen everything works well on this screen. But as soon as I drag this return, he is again choppy. GAL of the entire system, not only in the browser. Any of you encountered this problem? I tried everything I found on the internet, but nothing helped. It has the graphics card Intel Iris 6100, processor Intel i5 2.7 GHz and 8 GB of ram. He does this since I bought it.

    Hello romantu,

    Thank you for asking your question here in Apple Support communities. I understand that you are experiencing some lag with the entire computer. I am pleased to offer you things to try to isolate or fix it for you.

    As always, we want to ensure the data on your Mac is safe. You will need to use Time Machine to backup to an external hard drive. The recommendation is to use an external hard drive twice the size of your hard drive internal. Use this article to help make a backup: use Time Machine to back up or restore your Mac.

    Once you have a backup, you will want to check if the system latency occurs in safe mode and a test user. Safe mode will tell you if the problem is related to a startup item or plugins, and a test user will let you know if the problem is related to your account, or at the system level. It will be difficult in safe mode, because safe mode runs a little slower. It may look like he is also experiencing lag while is not. Test and try to see if the video is the same as it did before. Check if the problem goes away on the monitor full HD in safe mode. See this article for help to find out how to enter safe mode: try safe mode if your Mac does not start-up. There is a section called "If a problem does not occur in safe mode" you can work through the if the problem does not have the same or at all while you are starting up in safe mode.

    If you get through the safe mode article and still questions or if the problem also happens when starting in safe mode, you will want to check if the problem occurs to a test user. This article will help you do it. How to test a question in another account on your Mac user. There is a section called "If a problem occurs in account only one user" that leads to this article help: Mac OS x: how to solve a problem of software. You want to go through this article, if the problem occurs only in your main administrator user and not the test user.

    If the problem occurs in safe mode and test user, you'll want to reinstall OS X. Use this help article: How to reinstall OS X. See the section titled "If you reinstalled for other reasons.

    Thanks again and have a great rest of your day.

  • Camera button works is not only on the application native camera

    Hi all!

    I can't work with my native Xperia Z2 only on the camera app camera button. If the first step is pressed, it wakes the phone and begin to focus, but the second step doesn't work at all (only on the native app)
    It does not take pictures in all modes (auto, manual, facing the camera) and don't start recording.

    I've tested on other applications (Google camera, Instagram and so forth) and works as expected, the two steps with a click of the button. And button also passed the test in the System Diagnostics.

    Already deleted the money, deleted all the data, tried to CCP. Everything.

    In summary, will not work on Sony Xperia z2 native camera app, but works anywhere else!

    Is this a problem of update of Marshmallow? Is this a problem app?

    Thanks for your time,

    Billy

    Unfortunately if it depended on local support, I might as well throw it in the trash! I'm of the Brazil and that's how clients support usually work. They will say that the phone has a critical problem and will tell you to buy another... Hehehehe

    Thanks to all for help! Best regards!

  • The fonts using custom with the NDK

    Hello. I develop a simple game with the NDK and would like to know if anyone knows how I can load a police custom in the playbook in my game. I tried to copy it with the rest of the resources and charging from there, but when I try to load the font with the "FT_New_Face" function, I get an error and the error code returned is 1. I tried with different fonts (ttf and OTF) and the result is always the same. Anyone know how I can solve this problem, or even if it is possible? Thank you.

    I found the problem on my end, typo. The path must contain no attack "/":

    "app/native/BILLH___.TTF"
    

    Scott

  • Shared library with 10.2 NDK

    I have some classes of Qt/stunts, I'm working on that I want to incorporate a shared library.

    Originally, I was able to follow http://supportforums.blackberry.com/t5/Native-Development-Knowledge/How-to-create-a-shared-or-static... to create the library, but in the latest releases of the NDK, this does not work.

    Method B of this article does not work for Qt\Cascades classes since moc is never called, even if the used compiler is QCC. If I want to do a project of Qt\Cascades, I can only do an application project. If I tape everything that is not related to the library (assets, translations, master, etc.). I got some errors.

    Is first with the missing translation files. This can be corrected by changing the make files and the file *.pri (although I guess it will be readded by the NDK...)

    The second and more important question, is that even when I add "TEMPLATE = lib" in the file * .pro, which appears to have ignored, I get an error which is described as 'missing main function', which tells me that it is still trying to apply as opposed to a *. so.

    How can I produce a shared Qt\Cascades within the current NDK 10.2 library?

    Discover my stunts/Qt library template https://github.com/blackberry/Cascades-Community-Samples/tree/master/Cascades-Library-Template.

    It should have everything you need.

  • Native SDK is suitable for text-based application?

    I write an application based on the text for Playbook. I read the libraries and learning native SDK for the last days. Now I can't find an easy way to 'draw' texts on the screen of the playbook.

    Please give me some pointers or suggestions.

    If native SDK do not, let me know related libraries or knowledge that I need to look for.

    If the native SDK is not appropriate, what development tool would you suggest me to use? HTML5 or something else? And why?

    I'm new to this forum and new to playbook.

    Thank you.

    Native development kit is not really appropriate, unless you are ready to use the libraries of the add-on as the port of Qt, which is perhaps still a work in progress. The NDK for target now is mainly to games or other applications for which should be essentially generate UI whole 'manually '.

    HTML5 can obviously manage text. So can air. I can't recommend one over the other, or any other environment for you, since "text-based application" is not really describe what you are trying to reach.

  • Difference between native development & Development cascade...

    Am new to the blackberry development. Please is what someone did say whats difference between native development & development waterfall...

    Use it as a starting point: https://developer.blackberry.com/develop/platform_choice/ndk.html

  • Cannot compile the sample applications with the native SDK BB10

    Hello

    I downloaded the BB10 (10.0.4) native SDK and the sample application pack. However, some of the sample apps fail to compile (AudioControl and BelligerentBlocks, for example). The target isn't the playbook (Simulator).

    I get an error do the following:

    make [2]: * [C:/ndk-10.0.4-workspace/AudioControl/arm/o.le-v7/AudioControl] error 1
    make [1]: * [all] error 2
    make: * [all] error 2

    Looking at the newspapers of generation, I receive the following linker error:

    'C:/ndk-10.0.4-workspace/AudioControl/arm/o.le-v7 '.
    C:\bbndk-10.0.4-beta\host\win32\x86\usr\bin\ntoarm-ld: Notes: 'screen_get_window_property_pv' is defined in DSO C:/bbndk-10.0.4-beta/target/qnx6/armle-v7/usr/lib/libscreen.so.1 try so add to the linker command line
    make [1]:

    Am I missing something obvious? I'm competely new to makefiles, so if anyone has a suggestion, it would be welcome.

    Thank you.

    The latest NDK for Playbook is available from: //developer.blackberry.com/native/download/

    For waterfalls NDK 10.0.4, follow the instructions in Momentics content/getting started/Getting Started Guide Help/help / install and set up the Simulator

  • Native of filebrowse using and the cascading Save dialog box

    In my application I need to open file and file save dialog box when a specific button is clicked. I looked at the docs of stunts, but I found that the native options. Tried the native alert dialog, change of filebrowse dialog type. It displays well on Simulator, but could not get any output file that will be used in the Qt code.

    I pass these parameters

    int * num = NULL;

    char * folder [1024];
    dialog_update (alert_dialog);

    to dialog_event_get_filebrowse_filepaths(event,file,num), but it always returns BPS_FAILURE.

    In addition, access_shared is present in the bar-descriptor

    Here is my code:

    //slot function
    void App::fileOpen(){
        //===========================
            dialog_instance_t alert_dialog = 0;
    
            bps_initialize();
    
            dialog_request_events(0);    //0 indicates that all events are requested
    
            if (dialog_create_filebrowse(&alert_dialog) != BPS_SUCCESS) {
                        fprintf(stderr, "Failed to create alert dialog.");
                        return ;
                }
                const char* extensions[] = {"*.*","*.jpg","*.jpeg","*.mp3","*.wav","*.mp4","*.txt","*.doc","*.pdf"};
                int items = 9;
                if(dialog_set_filebrowse_filter(alert_dialog, extensions,items) != BPS_SUCCESS){
                    fprintf(stderr, "Failed to set alert dialog message text.");
                            dialog_destroy(alert_dialog);
                           alert_dialog = 0;
                           return ;
                }
               if( dialog_set_filebrowse_multiselect(alert_dialog,FALSE)!=BPS_SUCCESS){
                   fprintf(stderr, "Failed to set alert dialog message text.");
                                dialog_destroy(alert_dialog);
                               alert_dialog = 0;
                               return ;
               }
    
            if (dialog_show(alert_dialog) != BPS_SUCCESS) {
                fprintf(stderr, "Failed to show alert dialog.");
                dialog_destroy(alert_dialog);
                alert_dialog = 0;
                return ;
            }
    
            int shutdown =0;
            while (!shutdown) {
                bps_event_t *event = NULL;
                bps_get_event(&event, -1);    // -1 means that the function waits
                                              // for an event before returning
    
                if (event) {
                    if (bps_event_get_domain(event) == dialog_get_domain()) {
    
                        int selectedIndex =
                            dialog_event_get_selected_index(event);
                        const char* label =
                            dialog_event_get_selected_label(event);
                        const char* context =
                            dialog_event_get_selected_context(event);
    
                        char **fileArray[]={};
                        int *numFiles = NULL;
                       //
                              if(selectedIndex == 0){
           shutdown = 1;//user press the cancel button on dialog; close the dialog
       }
       else if(selectedIndex == 1){
           if(dialog_event_get_filebrowse_filepaths(event,file,num)!=BPS_SUCCESS){
           fprintf(stderr,"File open fail");
       }
       else{
    
    //debug purposes
           fprintf(stderr,"File array: %d/n",sizeof(file)*1024);
               fprintf(stderr,"Num files: %n",num);
               //fprintf(stderr,"Files int: %d",files);
       }
    
       }
                    }
                }
            }
    
            if (alert_dialog) {
                dialog_destroy(alert_dialog);
            }
            //===========================
    }
    

    Native Subforums have no useful information on this subject. Any help is greatly appreciated

    Hello again, here's the example as promised.

    To use the native filebrowse dialog box, the native code must run in its own thread to prevent the user interface in the Cascades to block. This is achieved by encapsulating all the dialog box code in a class derived from QThread.  The class I wrote is called FileBrowseDialog

    FileBrowseDialog.hpp

    #ifndef FILEBROWSEDIALOG_HPP_
    #define FILEBROWSEDIALOG_HPP_
    
    #include 
    #include 
    #include 
    
    /*
     * The file browse dialog displays a dialog to browse and select
     * files from shared folders on the system.
     */
    class FileBrowseDialog : public QThread
    {
        Q_OBJECT
    
        /*
         * QML property to allow multiple selection
         */
        Q_PROPERTY(bool multiselect READ getMultiSelect WRITE setMultiSelect)
    
        /*
         * QML property to read the selected filenames
         */
        Q_PROPERTY(QVariant filepaths READ getFilePaths)
    
        /*
         * QML property to set or get the file filters. This is an
         * list array variant.
         */
        Q_PROPERTY(QVariant filters READ getFilters WRITE setFilters)
    public:
        /*
         * Ctor and Dtor
         */
        FileBrowseDialog(QObject* parent = 0);
        virtual ~FileBrowseDialog();
    
        /*
         * Exposed to QML to start the run loop which creates and displays the dialog.
         * The dialog is shown until a button is clicked.
         */
        Q_INVOKABLE void show();
    
    public:
        /*
         * Getter for the selected filenames QML property
         */
        QVariant getFilePaths() const;
    
        /*
         * Setter and Getter for the filters QML property
         */
        QVariant getFilters() const;
        void setFilters(QVariant const& value);
    
        /*
         * Getter and Setter for the multiselect QML property
         */
        bool getMultiSelect() const;
        void setMultiSelect(bool value);
    
    signals:
        /*
         * Signal emitted when the OK button has been clicked on the browse dialog
         * The OK button is not enabled unless a file is selected
         */
        void selectionCompleted();
    
        /*
         * Signal emitted when the cancel button has been clicked on the browse dialog
         */
        void selectionCancelled();
    
    protected:
        /*
         * Implements the run loop. Dialog stays open until a button is clicked.
         */
        virtual void run();
    
    protected:
        dialog_instance_t m_dialog;
        bool m_multiSelect;
        QVariantList m_filePaths;
        QVariantList m_filters;
    };
    
    #endif /* FILEBROWSEDIALOG_HPP_ */
    

    FileBrowseDialog.cpp

    #include "FileBrowseDialog.hpp"
    #include 
    #include 
    
    FileBrowseDialog::FileBrowseDialog(QObject* parent)
        : QThread(parent)
        , m_multiSelect(false)
    {
        m_filters.push_back(QString("*.*"));
    }
    
    FileBrowseDialog::~FileBrowseDialog()
    {
    }
    
    void FileBrowseDialog::show()
    {
        if (!isRunning())
        {
            m_filePaths.clear();
            start();
        }
    }
    
    QVariant FileBrowseDialog::getFilePaths() const
    {
        return m_filePaths;
    }
    
    bool FileBrowseDialog::getMultiSelect() const
    {
        return m_multiSelect;
    }
    
    void FileBrowseDialog::setMultiSelect(bool value)
    {
        m_multiSelect = value;
    }
    
    QVariant FileBrowseDialog::getFilters() const
    {
        return m_filters;
    }
    
    void FileBrowseDialog::setFilters(QVariant const& value)
    {
        m_filters = value.toList();
        qDebug() << "filter count: " << m_filters.count();
    }
    
    void FileBrowseDialog::run()
    {
        bps_initialize();
    
        //request all dialog events
        dialog_request_events(0);
        if (dialog_create_filebrowse(&m_dialog) != BPS_SUCCESS)
        {
            qDebug() << "Failed to create file browse dialog.";
            emit selectionCancelled();
            return;
        }
    
        //set the selection filters
        if (m_filters.count() > 0)
        {
            char** ext = (char**)new char[m_filters.count()*sizeof(char*)];
            int i = 0;
            for (QVariantList::iterator it = m_filters.begin(); it != m_filters.end(); ++it, ++i)
            {
                QString filter = it->toString();
                if (!filter.trimmed().isEmpty())
                {
                    int length = (filter.length() + 1) * sizeof(char);
                    ext[i] = new char[length];
                    strncpy(ext[i], filter.toAscii(), length);
                }
            }
            if (dialog_set_filebrowse_filter(m_dialog, (const char**)ext, m_filters.count()) != BPS_SUCCESS)
            {
                qDebug() << "unable to set file browse dialog extensions";
            }
            for (i = 0; i < m_filters.count(); i++)
            {
                delete ext[i];
            }
            delete ext;
        }
    
        if (dialog_show(m_dialog) != BPS_SUCCESS)
        {
            qDebug() << "Failed to show file browse dialog.";
            dialog_destroy(m_dialog);
            m_dialog = 0;
            emit selectionCancelled();
            return;
        }
    
        bool shutdown = false;
        while (!shutdown)
        {
            bps_event_t* event = NULL;
            bps_get_event(&event, -1);    // -1 means that the function waits
            // for an event before returning
    
            if (event)
            {
                if (bps_event_get_domain(event) == dialog_get_domain())
                {
                    //0=ok, 1=cancel
                    int selectedIndex = dialog_event_get_selected_index(event);
    
                    if (selectedIndex == 1)
                    {
                        int count;
                        char** filepaths;
                        if (BPS_SUCCESS == dialog_event_get_filebrowse_filepaths(event, &filepaths, &count))
                        {
                            for (int i = 0; i < count; i++)
                            {
                                qDebug() << "selected file: " << filepaths[i];
                                m_filePaths.push_back(QString(filepaths[i]));
                            }
                            bps_free(filepaths);
                        }
                        emit selectionCompleted();
                    }
                    else
                    {
                        emit selectionCancelled();
                    }
    
                    qDebug() << "Got file browse dialog click";
                    shutdown = true;
                }
            }
        }
    
        if (m_dialog)
        {
            dialog_destroy(m_dialog);
        }
    }
    

    This class derives from QObject (by QThread) which means that it can be used by QML when it exposes properties and signals. The FileBrowseDialog class has 3 properties

    -multiple selection: a Boolean flag indicating if single or multiple selection is allowed

    -filepaths: a read only value that returns the list of files selected

    -Filters: a read/write value is where you can specify one or more filters to file (for example, ".doc", "*.jpg") etc.

    The next part is how you call the FileBrowseDialog through the QML. To do this, we must inform the QML of the FileBrowseDialog page. This is done in the App class via the qmlregistertype code.

    App.cpp

    #include 
    #include 
    #include 
    
    #include "app.hpp"
    #include "FileBrowseDialog.hpp"
    
    using namespace bb::cascades;
    
    App::App()
    {
        qmlRegisterType("Dialog.FileBrowse", 1, 0, "FileBrowseDialog");
        QmlDocument *qml = QmlDocument::create("main.qml");
        qml->setContextProperty("cs", this);
    
        AbstractPane *root = qml->createRootNode();
        Application::setScene(root);
    }
    

    The QML is now ready to be able to use the FileBrowseDialog. The example below is a page complete qml which has a button and a label. When we click on the FileBrowseDialog button is open, and all selected files will appear in the label.

    Main.QML

    import bb.cascades 1.0
    import Dialog.FileBrowse 1.0
    
    Page {
        content: Container {
            Label { id: filebrowseDialogLabel }
            Button {
                text : "File Browse Dialog"
                onClicked: {
                    filebrowseDialog.show();
                }
            }
            attachedObjects: [
                FileBrowseDialog {
                    id: filebrowseDialog
                    multiselect : true
                    filters : ["*.doc","*.jpg","*.txt"]
                    onSelectionCompleted: {
                        if(filebrowseDialog.filepaths.length>0)
                            filebrowseDialogLabel.text = filebrowseDialog.filepaths[0];
                        else
                            filebrowseDialogLabel.text = "no file selected";
                    }
                    onSelectionCancelled: {
                        filebrowseDialogLabel.text = "file browse dialog was cancelled";
                    }
                }
            ]
        }
    }
    

    And it's pretty much just invoke the native dialog file navigation in stunts. Please note save the file would follow a similar model, but I found that this dialog box was not particularly useful because it displays only a simple dialogbox with a text file name entry.

    See you soon

    Swann

  • Native SDK 2.0 to BB10/cascades...

    I want to start on the writing of native code.  The only device I currently have is a Playbook, so if I start writing apps stunts I won't be able to try on a real device until the playbook is upgraded to BB10 (probably several months?).

    However, I don't want to waste a lot of time learning and writing difficult code user interface as part of the old since BB10 is just around the corner.

    My question - if I started apps written using SDK 2.0 native, it will be simple enough to convert and re - build these apps under the SDK BB10/Cascades later?  Or I'll lose a lot of time learning and writing code that will be obsolete in the new framework?

    If these are not games, but 'Affairs' apps or something else, where you would buttons standard aspect of system, text fields and so on, then, you cannot do with the NDK now at all the...

    If the application's UI-heavy, and you do not want to use stunts, so your best bet is to work with the new Simulator of BB10 beta for now because it supports Cascades.

    If the application is not UI-heavy, but you do not want to keep as close an app of Cascades operation behind the user interface, and then you talk about Qt and can actually run on the PlayBook even Qt applications now. But not with all the parts of the Cascades. If this is an option, use the NDK with the Qt libraries.

    Also consider attending a day BB10 Jam during the "world tour" http://www.blackberryjamworldtour.com and see if you can get a Dev Alpha to test.

    Moreover, 'several months' seems optimistic... I think you can assume rather not before October at the earliest. If they decide to put all libraries of stunts in 2.1, however, or if there is a beta version of developer of BB10 on the PlayBook before the fall, and then those who could help you. They not have given any indication yet (AFAIK) that they could do.

  • Development of native android apps (I know this isn't a sub-forum appropriate, but..)

    Currently, android player is missing from the feature of running native code, because there is no support for arm v7le. If anyone can help on porting/add support for arm v7le in android ndk toolchain?

    Oh well not like android JNI, because it must be accompanied by our performance of dalvik which is not supported now as far as I KNOW

  • testing native code for running on battery

    is it possible for a native C application test if running on battery power or not?

    I don't need levels. just battery/notbattery.

    Thank you.

    nothing about the battery/charger/power in docs ndk. Maybe access to ' / pps/services/power / "can help you? It is dirty way, but it's the only thing in my mind right now

  • Call native applications

    Does anyone know how we can call native applications such as the browser, email client or AppWorld? I've seen other applications invoke the browser and email, so I know it's possible, but I can't find anything in the documentation of the AIR.

    @Ebscer, there are likely several ways that work, which uses navigateToURL() with a 'plan' appropriate.

    Using of "file:", "http:", "https:" and possibly others should open the browser.

    I don't know if others have been documented yet. I've seen either "app:" or "appworld:" in the Simulator (down in the tree of /pps somewhere under "navigator") but I need to get my tablet before I can experiment more with this as the Simulator, of course, is almost useless for such things.

    There are also several other techniques mentioned at the beginning of this thread: http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/PDF-word-and-xls-support-in-playb...

Maybe you are looking for

  • Mail app crashes after updating iOS 10

    I've just updated to iOS 10 on my 4 32 GB iPad. The Mail app often closes unexpectedly. I have no problem to use it again, but it's boring. Since this is an Apple app, I can't uninstall & install again. Any suggestions?

  • Satellite Pro L300D - 22E - Bluetooth stack to crash the laptop

    Hello I recently bought a 22nd L300D I was aware that it came without internal Bluetooth but I have a USB dongle which is detected fine under vista, but then it tells me I need Toshiba bluetooth stack and point me to the download. So, I download and

  • Text box for data entry

    Hi guys,. I have a few areas of data entry in my GUI that I control. The data are entered in hexadecimal format, IE. Ox is sitting next to the text entry box and the user must enter a value between 00 and FF for a single byte. As soon as the user tri

  • Best software burn for WVC54CGA?

    What is the best software to allow me to record activity on a number of cameras on the internet? I find the included software lame, and I find it difficult to find a software from a third party who takes care of the WVC54CGA. I have also good XP and

  • P4014 with large capacity cartridge

    Hello fellow printers,. The company I work for having bought a new HP Laserjet P4014, they also bought a toner cartridge high capacity (CC364X). The problem is when I put the toner cartridge high capacity in the printer, the lid does not close becaus