confusion in the background process and Globaleventlistener

Hello

too confused in Backendprocess.

Please check my code and then tell me how I can do this.

I want to add bluetooth address in my tree UIApp MyScreen articles and I bluetooth address storage file and record store.

but confuesd how do I call the showAdress() method after complition of search BlueTooth.

public class MyUIApp  extends UiApplication{

    public static void main(String[] args) {
        if (args != null && args.length > 0 && args[0].equals("gui"))
        {
            AppBackend appb = new AppBackend();
            appb.enterEventDispatcher();

        }
        else
        {
            ApplicationManager appMang = ApplicationManager.getApplicationManager();
            if(appMang.inStartup())
                return;
            MyUIApp app = new MyUIApp();
            UiApplication.getUiApplication().invokeLater(new Runnable() {

                public void run() {

                    ApplicationManager.getApplicationManager().postGlobalEvent(AppConstants.DATA_CHANGED);
                }
            });

            app.enterEventDispatcher();
        }
    }

    public void showAdress()
    {
        getting data from record store adding Tree which si on Main Screen.
    }
}
public class AppBackend extends Application implements GlobalEventListener {

    public Timer timer;
    public Vector remote_device;
    public Vector device_found;

    BTSearch btSearch;

    public AppBackend() {

        addGlobalEventListener(this);
        timer = null;

    }

    public void firststart() {
        btSearch = new BTSearch();
        btSearch.start();
    }

    class BTSearch extends Thread implementsDiscoveryListener
    {

        boolean stopThread = false;

        public void run() {
            startThread();

        }

        public void startThread() {

            timer = new Timer();

            timer.schedule(new TimerTask() {

                public void run() {

                    startScanBluetoothDevices();

            }, 30000, 30000);

        }

        public void startScanBluetoothDevices() {
            try {

                remote_device = new Vector();
                device_found = new Vector();

                discovery_agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
                discovery_agent.startInquiry(DiscoveryAgent.GIAC, this);

            } catch (Exception error) {
                Dialog.alert(error.getMessage());
            }
        }

        public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
        {
            //
        }

        public void inquiryCompleted(int discType)
        {
            //
        }

    }

    public void eventOccurred(long arg0, int arg1, int arg2, Object arg3,
            Object arg4) {

        if (arg0 == AppConstants.DATA_CHANGED) {

            firststart();

        }

    }

}

I'm confuesd how do I call the method showAdrees() If you desire to process bluetooth backend made.

Now I'm for names of Bluetooth and the storage in the RecordStore. but now the problem is how can I display on my main screen located in UIApplication.

I am struggling to read this code, it seems not to be complete.

Sorry, beginning with the obvious things, I assume you have another entry.  Usually one who has the 'gui' param starts the user interface, so I guess that BlueFreeBackround is the treatment of the user interface.  Seems a strange name?  But any.  We do not have this code, so can't review it.

The other entrance is the one who starts the initial treatment.  In case you're MyUIApp.  But you have this:

If (appMang.inStartup ())
return;
Also if this is executed at boot time, the treatment does nothing.  And you start an application that seems to be the associated user interface.  I'm confused.  And we have no code to the constructor for this class, so we can not comment on that either.  All we know is that this class sends a global event.  Now, if I'm wrong, I don't think you need to start an Application to send a global event.  It is enough to have one to receive a.

And you have given us another class, but there is no indication how it is started.  Assuming that it is started, it will receive the global event and execute the firststart() method.  Confusingly, this method will start a Thread that starts a timer.  Why can't firststart() him and save a Thread and some confusion?

OK, now we come to the TimerTask, which is launched every 30 seconds (seems too often to me, but maybe not).  This process begins the investigation.  And we arrive at the point of this thread.  InquiryCompleted, I think you want to call showAddress().

It's actually easy, although I really don't like this approach:

Instead of using

postGlobalEvent (long guid);

use

postGlobalEvent (long guid, int data0, data1, object0 object, Object1 int);

and pass the MyUIApp object as a parameter object0.  Then, you can call

. showAddress();

I suspect that this will throw IllegalStateException, so you'll need to hire a

this.invokeLater (...)

to ensure that you have the thread of events when refreshing.

But if I were you, I would consider this approach.  It seems some unnecessary steps.  For example, why doesn't MyUiApp start the discovery itself, what s at the point of the AppBackend?  A; Otherwise, you use a global event to initiate treatment, you could send the data in another GlobalEvent.

Tags: BlackBerry Developers

Similar Questions

  • Showing a standby screen while the background processing

    Hi all

    I implement a wizard have been I let the user fill in some parameters of network connection. When the user clicks 'next' I want to run a background process to see if the entered parameters are correct. According to the result of the background process, the wizard can continue to the next screen or remain on the current screen.

    There must be something like this:

    boolean onNext()
    {
      // Executed when the user presses 'next' (run in the EDT)
    
      // Show a wait popup
      UiApplication.getUiApplication().pushScreen(progressPopup);
    
      // do my network stuff
      boolean success = false;
      UiApplication.getUiApplication().invokeAndWait(new Runnable()
      {
        public void run()
        {
          // try to connect to the network
          // ...
          success = true;
        }
       });
    
      // hide the popup
      UiApplication.getUiApplication().popScreen(progressPopup);  
    
      // return whether the network stuff was successful
      return success;
    }
    

    This does not work because the popup does not appear. How can I achieve that?

    Thanks in advance!

    Modal screen is very good and has some advantages, in that it means that your logic that knows what it is in the State.

    What you want to do depends on the application.  For example, we have a server locator tool, the user launches the search, then we do not secure anything, except that they cannot launch a new search until they cancel the old one.  Alert us when the search is completed or dead or expired.

    With a modal form (and we do too) I personally like this to have a Cancel button, so that the user can stop waiting - which complicates the Interface.  In fact, there is a case for the wireless network to bring an observer of the screen modal, so that he knows that he has to ignore the answer if the screen has been cancelled.

  • I just bought an iphone 6 s second part and I got home put my SIM in there turn it on you try to start the activation process and he says that the phone is lock icloud, I tried calling get him etc. but he gave me the wrong information help please 91026128

    I just bought an iphone 6 s second part and I got home put my SIM in there turn it on you try to start the activation process and he says that the phone is lock icloud, I tried calling get him etc. but he gave me the wrong information and I called apple, they said that its nothing they can do without evidence of perchise im broke I spent all my money on the phone, does anyone know any software free or something me please txt to 9102612856

    @Santonio99

    You probably bought an iPhone stolen 6. Mine was stolen in Barcelona in Spain on June 10 by a pick-pocket. Fortunately, there is absolutely nothing you can do to make an iPhone locked to the activation of the work.  You have a paper weight.

  • When you install windows 95, which is the executable that launches the installation process, and where it is located?

    When you install windows 95, which is the executable that launches the installation process, and where it is located?

    The file is setup.exe.  Depending on your version of Windows 95 CD, it could be in the WIN95 folder or in a subfolder of WIN95.

    If you have more Windows 95 questions, great places to get responses are microsoft.public.win95.setup and microsoft.public.win95.general.discussion newsgroups.  It is a Windows XP forum.

  • Whenever I have shut down my computer, it displays a popup saying to close the background image and then it stops.

    Original title:

    Whenever I have shut down my computer, it displays a popup saying to close the background image and then it stops. Should what settings I change so that does not happen?

    Hello

    1. What is the brand and model of the computer?

    2 have you made any changes to the computer, before the show?

    Method 1:

    Perform a clean boot and check.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    Note: Once you are done with the boot, follow step 7 of article to reset your computer to normal startup.

    Method 2:

    Change the wallpaper and check.

    Change your desktop background (wallpaper)

  • How to export a single job Disqualification as well as the related processes and data warehouses

    Hello

    I'm new to OEDQ. May be that it is a fundamental issue. But I am not able to find any way. Help, please.

    I use OEDQ version9 and installed locally in my system. I prepared a working with a CSV file as source and used some transformations of control (data type, control the length) in my process ( I've also enabled publish it on the dash for this process option) to prepare the work.

    Then I took the export of .dxi of employment by right-clicking on the name of the job and by selecting the package.

    But when I import this package dxi to another machine is not able to find the related processes and then I am unable to run the TASK.

    Now, is it possible in OEDQ where I can take export a JOB with connections and related processes?

    Kind regards

    Samira

    It is normally easier to pack the whole project, but for any object, you can filter a project first and then package it. To do this for a job, right-click on the task and select filter of dependence - elements used by the selected item. Then package the filtered project - this upward work package manager and all other dependencies (data banks, data interfaces - you won't have to 9.0), snapshots, data staging, refer to data, process etc..) The same works for other objects and processes.

    I would note that since three version major 9.0 so you are encouraged to use a newer version if possible.

  • When I edit a .wav file (noise reduction to remove the background hiss) and save them, the changes are not saved.

    I just installed hearing and have edited a few audio voiceover to remove the background hiss.  When I save the changes and reopen the file, the hiss is back.  The changes are not saved.  Why is this happening?  How to record the sound of the effects of reduction in my .wav file?

    [Ask in the correct forum allows... Left generic Cloud/Setup forum for forum specific program... MOD]

    shionak wrote:

    I capture the background hissing noise footprint > click apply > click on select, then click on apply again.

    These steps are not quite correct. You have two choices; either highlight a part of the background noise and use SHIFT + P, which captures your selection as a basis for NR or, open the Panel NR and use "Capture noise Print" from there, after making a selection first. After doing this, click on "select an entire file. What you definitely have to do is to use 'apply' at this point, and when use you it, just use it once.

    When you capture using printed, the Preview 'play' button inside the plugin to check the settings and then stop it. When you are satisfied of what he done, then click on 'Apply' - but once. This will apply for all of your noise reduction. As long as you do not use "undo" at any time, the version Number will be be recorded on the original, or if you use "save under", then the original will be left alone, and a new noise-reduced version will be saved.

  • When I click on color chart or color in the upper right corner, it's just in the background color and foreground color, how can I fix it?

    When I click on color chart or color in the upper right corner, it's just in the background color and foreground color, how can I fix it?

    Make sure that the foreground is selected in your color Panel, not the color of background as shown here.

  • the difference between the intermediate process and materials first in BCP formulation?

    I do not understand the difference between the intermediate process and materials first in BCP formulation. could you give me an example to show the difference?

    The intermediate process - questions all the specifications that are used in the

    current specification.

    Raw - questioned the level of material first in the hierarchy.

    Hello Terry,

    It is used in the screen output Formulation based PCA. You can configure different PCA rule which is available in formulating exit point BOM, then when you start a screen of PCA in the base of the exit, you will see this rule.

    And the difference between the intermediate process and raw in PCA, let me explain with an example, I have a configuration hierarchy as below:

    OutputA

    A formulation

    Material X

    Output B

    Formula B

    Material M

    Material N

    If I select the output B in formulating A framework, and when I run a screen of PCA in the base of the output, I have three options:

    High level - it allows to extract A output attributes as PCA review the settings;

    Intermediate processes - it to retrieve attributes material X and B output like BCP review the settings;

    Raw - it will extract attributes of material X, output B, M and N of material material as PCA review the settings.

    I hope this helps.

    Thank you

    Jessie

  • My gradient does not work.  He worked on an image and then stopped on the next!  I have cs6.  It is just the display of the background gray and white checkerboard on the upper left corner.  I click on the arrow down to see if I can it go back to black and

    He worked on an image and then stopped on the next!  I have cs6.  It is just the display of the background gray and white checkerboard on the upper left corner.  I click on the arrow down to see if I can get it back to black and white and it will not change... it will not change if I click on any of them.  I think it might be a bug?  Any ideas will be appreciated.  I tried to reset them as well.  Thank you!!

    Check your Options bar.  You have the opacity set to 10%.  Easy to do.  Just hit the 1 key while the gradient tool is selected, and it's done. By pressing the 0 key will take you back to 100%

  • Inter Process Communication and Hidden in the background process?

    Hai,

    I am facing a problem of developing application in adobe air... I need to know the inter process communication and hidden background processes. Anyone have idea about this problem, please help me.

    Thank you

    Dembélé

    You can't have a background process on the PlayBook. All applications are executed by the user and are foreground processes. In regards to the communitication between the processes to run applications, have taken it.

  • Issue of permanent withdrawal for the background process

    Dear all,

    Oracle DB Version: 11.2.0.3

    Version of the OS: RHEL 5.10

    We have the below listed (with the exception of the mandatory process) background process when querying using the command "ps" on the DB server:

    ora_e006_SID
    ora_w001_SID
    ora_smco_SID
    ora_e007_SID
    ora_e008_SID
    ora_j000_SID
    ora_j001_SID
    ora_qmnc_SID
    ora_cjq0_SID
    ora_emnc_SID
    ora_q000_SID
    ora_q001_SID
    ora_e000_SID
    ora_e001_SID
    ora_e002_SID
    ora_e003_SID
    ora_e004_SID
    ora_e005_SID
    

    Whenever we're tyring to stop the database, he's waiting for active sessions. I predict the cause are treated the foregoing that delay the restart. I also predict that these background processes are releated to Oracle Streams. Can someone help me remove all background processes above? Can I permanently a solution? I've traveled to several sites but could not find the exact solution I'm looking for.

    SQL> show parameter aq
    
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    aq_tm_processes                      integer     1
    
    

    Above is the setting for the QA process.  Thanks in advance for the help.

    Kind regards

    Imran Khan

    This is resolved. It was a bug in 11.2.0.3. Raise SR Oracle and got the one-time patch. Applied and since then, it is not question at all.

    Thank you

    Imran Khan

  • Great for the background process paging space

    Hello
    in my former base 9.2 (on AIX) I see paging high use of space for background processes.
    #> svmon -Pg -t 1 |grep Pid ; svmon -Pg -t 10 |grep "N"
         Pid Command          Inuse      Pin     Pgsp  Virtual 64-bit Mthrd  16MB
     2285578 oracle          304609    81552   500909   605395      Y     N     N
     3350676 oracle          304588    81552   500643   605149      Y     N     N
     1794254 oracle          304592    81552   500634   605126      Y     N     N
     2744508 oracle          304567    81552   500189   604671      Y     N     N
     2588796 oracle          304700    81552   499905   604421      Y     N     N
      708788 oracle          304657    81552   499842   604336      Y     N     N
      598034 oracle          304621    81552   499696   604182      Y     N     N
     3035252 oracle          304666    81552   499662   604167      Y     N     N
     2736282 oracle          239031    81552   418381   522499      Y     N     N
     1220740 oracle          238960    81552   418310   522410      Y     N     N
    
    #> ps -eaf|grep 2285578
      ora9R2 2285578       1   0   Mar 01      -  0:28 ora_pmon_MYDB
    
    #> ps -eaf|grep 3350676
      ora9R2 3350676       1   0   Mar 01      -  0:34 ora_dbw0_MYDB
    
    #> ps -eaf|grep 1794254
      ora9R2 1794254       1   0   Mar 01      -  1:24 ora_ckpt_EGOV
    The database do nothing (from 09:00 to 17:00):
    Load Profile
    ~~~~~~~~~~~~                            Per Second       Per Transaction
                                       ---------------       ---------------
                      Redo size:                852.37             37,511.73
                  Logical reads:                 31.39              1,381.25
                  Block changes:                  3.35                147.35
                 Physical reads:                  0.09                  3.96
                Physical writes:                  0.16                  6.89
                     User calls:                  2.24                 98.51
                         Parses:                  1.33                 58.34
                    Hard parses:                  0.10                  4.27
                          Sorts:                  0.63                 27.93
                         Logons:                  0.01                  0.61
                       Executes:                  2.07                 91.04
                   Transactions:                  0.02
    But the free bolt is 40%:
    Top 5 Timed Events
    ~~~~~~~~~~~~~~~~~~                                                     % Total
    Event                                               Waits    Time (s) Ela Time
    -------------------------------------------- ------------ ----------- --------
    latch free                                          1,580          88    42.63
    File system mount options are correct (cio of dbf, etc.)
    Parameter:
    filesystemio_options                 string      async
    disk_asynch_io                       boolean     TRUE
    optimizer_mode                       string      RULE
    Any ideas why it uses a lot of paging space?
    Thank you.

    Mr.D. says:

    sb92075 wrote:

    Mr.D. says:
    Hello
    in my former base 9.2 (on AIX) I see paging high use of space for background processes.

    What value will the use of paging to be OK to be 'high '?
    Is this true & valid value for EACH database on this planet?

    Do you realize that the modern BONES are actually DESIGNED for the page?
    So why is that a bad thing, report you it?

    Yes I realize
    But if topas show me about 20% wait for I/O and the affected hdisk is the swap and it is occupied about 97 to 100%
    I think that there is a problem.

    Thank you.
    >
    >
    >

    Hello
    in my former base 9.2 (on AIX) I see paging high use of space for background processes.

    What value will the use of paging to be OK to be 'high '?
    Is this true & valid value for EACH database on this planet?

    Do you realize that the modern BONES are actually DESIGNED for the page?
    So why is that a bad thing, report you it?
    Yes I realize
    But if topas show me about 20% wait for I/O and the affected hdisk is the swap and it is occupied about 97 to 100%
    I think that there is a problem.

    Thank you.
    If the OS is really trading & Oracle is only application on the server system, then SGA is too big.

  • Is there a way to make different background colors on a web page? I put the background color and it comes out always white. Text colors do not either.

    I developed a webpage using Microsoft Publisher 97.  I made the bottom of the pages a color special and changed the color of the text on some points.  When I download the page via sftp, and then he discovers the background is white and the colours of text disappeared.  I don't know much about html or CSS.  Can you tell me why this happens?

    Hi Don,

    The question you have posted is better suited to the MSDN Community. Please post your request in the following link to MSDN for assistance.

    Internet Explorer Web development

  • 2 entry points (background/foreground) - cannot set the icon for the background process

    Hello

    I have 2 points of entry: the first plan and background. Both are related to index.htm

    When I go to 'Download', I see my icon and it opens my application. No problem.

    When I press the "blackberry" button to view the applications that run in the background, I see my request but with no icon (just the default icon). I would like to see my icon.

    Any idea to solve this problem?

    Thank you

    The answer is in my other thread: http://supportforums.blackberry.com/t5/Web-Development/Change-icon-when-receive-new-push-data-from-B...

Maybe you are looking for