Focus of the application

Hi guys,.

Is it possible to know when the application gets the focus when the application loses focus? As if the application is running and you press the end key, the application is relegated to second place?

Thanks in advance

enable and disable the UiApplication methods

Tags: BlackBerry Developers

Similar Questions

  • How to change the icon of the application where the application focus?

    Hello guys

    I want to know how to change the application icon focus when the application.

    I know how to create the icon of the Application, such as insert icon-> properties-> use as the application icon.

    Do you know how to insert the second icon to the project?

    Please help me guys

    TNX'

    Hello

    Ago may messages on roll on icon.

    This is the KB article for the overview icon.

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

    KB article for icon creation.

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

    TNX.

  • Stack steals focus from other applications when trying to connect (and does not connect)

    We use the Toshiba stack in a communication workshop application. The application attempts to establish contact with other BT devices every 5 seconds. It runs in the background, so that the user can do what he usually does on the PC. However, if the connection cannot be established, the user loses focus on the application it is currently using, and when the focus returns does not return completely, the user should click on what he was doing. In this case every 5 seconds 2 seconds. This makes the useless PC for tasks other than the management of our product. We use the SPP profile series. Is there a solution?

    Check in "Bluetooth Settings-> Options-> other-> COM Auto settings-> connection settings... »
    If the COM ports are listed. Deselect it if so. Please let me know if it works for you.

  • Audio stops when the application is blurred

    Hello
    I've recently upgraded to a 64 bit win 8 PC for my home studio.  In workflow, I often play audio through FL Studio 11 when recording the voice or guitar in a separate wave editing program.  Because the Win 8 install, Audio will stop completely when I switch the focus of the application of the software of monitoring/recording so lose my "metronome."  The same software does not behave like that on the 64-bit Win xp computer.  Is there a setting to disable this behavior somewhere? I ' ts, causing serious problems in my workflow.

    Please notify.

    Thank you for your time!

    I don't pretend to even came close to understanding your program, so you must forgive my lame efforts to help you.

    What this means, if anything?

    "The ticked off Auto button close device if you want that other applications to be able to use the sound card if FL Studio loses focus (e.g. reduced). If you do not check this box FL Studio will continue to use the sound card even if it does not have the focus. Other applications cannot use the sound card in this case, which can be annoying. »

    FL Studio Tutorial - How to record an external audio source in FL Studio
    http://forbidden-fruity.blogspot.com.au/2009/09/how-to-record-external-audio-sources-in.html

  • Keyboard shortcut "Move the focus to the next window in the active application" system ignored

    Hello. Other than, for example, InDesign, Photoshop (12.0.2 x 64, Mac OS X 10.6.6 MacPro 4,1) seems to ignore the keyboard shortcut 'Move focus to the next window in the application active' systemic (in my case, and I think that generally, cmd - <). The key combination is not used by the set of keyboard shortcuts in Photoshop; in fact, Photoshop refuses to accept it as a shortcut, favourable to its use as a shortcut to System. But then why is inoperative in Photoshop and how to make it work?

    Thank you very much

    Adobe uses Ctrl Tab.

    CTRL F6 is the command of apple, I think you're talking about.

  • How to get the focus and the slider to textfield when the Application loading

    Hello
    In my application, I need the focus and the cursor on a control textInput that soon the application is loaded.
    The Focus can be set by textInputname.setFocus () in the full demand creation event. It works but
    the cursor do not appear there until what the user clicks anywhere in the area of application. Y does it have no way set cursor on
    the textfield on request load so that if the user enter something without clicking, on request, the text should go to this
    TextField.
    I tried the following things, but it do not cursor to textInput, only the focus is set with this,
    textInputname.setFocus ();
    CursorManager.setFocus ("textInputname");

    If anyone knows the solution please answer...
    Thank you...

    ' v Jay"wrote in message
    News:g6ume8$b8e$1@forums. Macromedia.com...
    > Hi,.
    > This logic to set the cursor to the load of the application with callLater do not work...
    > Do you have another idea

    The problem is that the reader Flash itself has not the focus. I think so
    There are hacks JavaScript that you can use to try to correct this, but I have no
    believe that they are reliable.

    HTH;

    Amy

  • River: Getting the application event get the focus

    Hello

    Is it possible to listen to when any application gain focus IE get application details when he user starts?

    Thank you

    -----------------

    P.Ramkumar.

    I use Applicationmanager for this.

    Thank you

    ----------

    P.Ramkumar.

  • How to focus with the Camileo X 200 in webcam mode.

    Hello, I have a Camileo X 200 and want to use it as a webcam from time to time, but the question I'll have with him is the inability to get the camera to focus for the use of Skype or other video-conference applications. Is there a way / program / driver needed for me to be able to focus the camera while using it as a webcam?

    Thank you very much

    Yamakiroshi

    Hello

    Must check this thread which is exactly on the same theme, if it is not necessary to open further discussions on the same topic:
    http://forums.computers.Toshiba-Europe.com/forums/thread.jspa?threadID=67481

  • must click twice to focus on an application

    This problem is rather difficult to describe, and I do not know the correct jargon, so I had to hurt looking for another thread that can ask the same question.

    Situation: I have two applications (this happens with any combination of applications), let's say TextEdit and calculator. The 'focus' is on the calculator. I can type in numbers from the keyboard, or click with the mouse on the calculator figures so he computes. No problem. But, if I want to then bring 'focus' to the TextEdit window - where if I type something - when I move the mouse anywhere on the window in TextEdit and click, it does not update to TextEdit and it remains greyed out. the focus remains on calculator.

    In order to get to restore the focus to TextEdit so I can type, I have to click twice on the app. However, I can't double-click on it or it will minimize the window. I have to click once, wait a few seconds, so it won't register as a doubclick and then click New. It of incredibly frustrating, slows down my work flow and I cannot for the life of me figure out how to change it. Happened for quite awhile, and I think changed after I downloaded some sort of new update, which one I don't remember unfortunately.

    Again, this happens with both applications. I am aware to be able to use the command + tab to switch between apps and I use it often, but sometimes using my mouse to organize windows or any other action is necessary.

    Any help would be much appreciated!

    Thank you!

    This would be me a lot.

    It is a test to identify the problem. Create a new account.  See if the problem persists.

    Move the finder to the desktop preferences.

    http://osxdaily.com/2014/12/16/show-user-library-folder-OS-x-Yosemite/

    Create new account

    Blue Apple > System Preferences

    clicks on the icon accounts

    Click the icon representing a lock if it is locked.

    Enter the password to logon

    Click on + icon (left side of the screen just above the lock icon)

    After you have created a new account, you must log out of your current account.

    Blue Apple > sign out name current number......

    Sign in to the new account. see if problem goes away.

    If she disappeared, some files preferably I messed up on your account. Rename the appropriate preference. You must understand the name.   These are .plist files.  Look for these files in the Preferences folder that is located in your library folder [more formally ~/Library/Preferences].  ... restart.

    Post back for assistance.

    More tips on creating a new account

    http://pondini.org/OSX/transfer.html

  • Return the focus to the main window of VI

    In fact, the scenario is a little more complicated than what is described.

    There is a main VI has a user interface that uses a Structure of the event to capture / process the events of the operator.  This same main VI also called live dynamic.  One of them has its own Structure of the event.  The code for the two screws was developed using LVOOP.

    There are shortcut keys associated with the main vi.  However, given that the main spaws Dynamics Dynamics VI VI VI is the active window.  As a result, all keyboard events are processed by the Structure of the event of dynamic VI (of course).

    However, when a keydown event is raised, it should be captured by the main VI.  The architecture of code cannot be changed.  What would be an appropriate method to make the main VI window active (so able to handle keyboard events) or be able to transmit events keydown event captured the main VI without a redesign of the architecture?

    Some ideas would be to register for outdoor events (which are sent to the hand) and create a keydown event in dynamic VI.  This may require the implementation of a queue.  Or because the code uses LVOOP, and then creating a lvclass to handle keydown events may be the way to go.

    I just want to get some feedback on potential "gatchas" which can hide when you try to implement a solution.

    Or maybe there is something simple that I've not taken into account.

    Thank you

    RayR

    Don't know much about your LVOOP, but I guess you know VI, FP. Run - Time.Minimized, to reduce to a minimum the dynamic VI of VI of the hand or the dynamics VI himself.

    Or you can use the Application method "Bring forward" after spawning dynamic VI. This will give the main VI keyboard back focus. I believe in KISSING.

  • Focus between two applications

    Hello

    I work with both applications at the same time, which is made with CVI and the other not (e.i. Explorer). The application made with CVI every 20 seconds displays a new Panel and take focus (hence the other app lose focus), but I would still keep the emphasis on the second request (Explorer). Is this possible?

    Thank you very much

    Daniele

    Danielle:

    Matteo has given you some useful links if you want to give your app focus.  But when I read your post, it looks like your application takes the focus and you don't want it.

    The attached sample project shows two ways to allow another application to keep focus when your application will normally consider.

    Both methods use the Windows SDK functions (a.k.a. Win32 API) to get or set the foreground window (the one with focus).  The Windows SDK is not installed by default with CVI.  It comes with the full package and the Suite OR developers, but not with the basic package.  If you have the complete package or suite, and you do not have the SDK installed, you just re-run the installation of the CVI and select only the SDK (or Win32 API).

    The basic idea behind the first method is that before you post your new Panel, you check to see which window is in the foreground by using GetForegroundWindow(), then your new display panel and then set previous window of the application in the foreground using SetForegroundWindow().  The downside of this method is that your new Panel has a quick flashing of focus before focus is returned to the other application.

    The second method checks if your app CVI is the foreground window before displaying the new window.  It does not display your new Panel if another application has the focus.  This way you don't get the blinks of update to your application CVI.  Depending on the purpose of your new Panel, you may have to display the new Panel when your application receives the focus instead to wait until 20 seconds to display.

    For demonstration purposes, this sample application appears again just the main draw instead of display a new Panel.  The two methods will be work the same way for a new Panel as well.

    Instructions for running the demo and see the two different methods are on the main Board.  Just build the application and run it.  I tested this example in CVI 6.0 and version 9.0.1.

    Having said all that, I have a question for you.   Why your application CVI shows a new sign every 20 seconds?  You can update an existing panel without using the DisplayPanel command and forcing the update to your application CVI.  Do you need a new Billboard?  And what happens after 20 seconds?  The first Panel again get hidden or destroyed?  Are another new panel displayed?

    There could be something even easier, you can do without one of these SDK, as do not use DisplayPanel if you need SetCtrlVal.  (But this model made for a writing exercise pleasure).

  • 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!

  • Move the focus from the listfiled to the particular label (horizontal scrolling problem)

    Hello

    In my application, I have some labels (which are focusable) at the top of the screen that I put in the manager (hfm_lbl) horizontal field with horizontal scrolling.

    After hfm_lbl, I have a listfiled.

    Now when I scroll to the top of the listfiled (i.e.from from bottom to top), the focus moves to top but sets the last menu of the hfm_lbl.

    I want the focus to specify the label of perticular.

    Any help is appreciated...

    Thank you...

    drawFocus won't help with this.

    The problem is only a HFM, when focus activates it by underneath, will automatically set the focus to the last item in the list.  Therefore, substitute this transformation.

    There are actually two options, depending on whether you want to override the onFocus method, or use a FocusChangeListener. I know that some people have had problems with the onFocus() substitution, so recommend the listener. But I never have, so after you will find a sample of the code that I use in this circumstance.

    The thing is that the treatment in the HFM should remember the lastFocusField (one of your labels) when the focus is moved there.  This challenge, I'll leave with you.  Still, he has a variety of options and not better.  So whatever you think probably will work fine.  One option is to set the HFM as a FocusChangeListener for all the domains that are added and then remember the last one, who won the point - then the treatment is autonomous in the HFM.

    The following codes assume that lastFocusField is a field in the HFM, one user had developed on before the ListField moved t.  This method overrides onFocus() in the HFM.

    protected void onFocus (int direction) {}
    super.onFocus (branch);
    If (direction! = 0 & lastFocusField! = null) {}
    UiApplication.getUiApplication () .invokeLater (new Runnable() {}
    public void run() {}
    lastFocusField.setFocus ();
    }
    });
    }
    }

    Edit: I think that Simon and I had to answer at the same time.  Just to say, in my experience in this case, you might be able to do it with moveFocus(), or navigationMovement(), but not as easily as onFocus().

  • Placeholder not cleared on focus to the Textbox control.

    I'm developing an application using JQuery Mobile and phonegap. I keep a placeholder in each text box. But these placeholders not been clear on the focus of the text box. For the first time on the focus to the text box it is clearing, but, if it hurts and focus again, then it is not clearing. This problem occurs only in 9800 touchscreen device. I tested in Bold 9780 and 9900, it works fine. But I don't know why this problem only occurs in the 9800 device. I am also using all the latest version of Phonegap, JQuery and Jquery Mobile.

    Finally found the solution.

    Here is the solution

    http://w3stream.blogspot.in/2012/11/placeholder-not-cleared-on-focus-to.html

  • The application to display very slowly, please give me advice, thanks.

    Dear all,

    Could someone give me some advice? Thanks, I'm new developer in the development of a program administered for BB bold 9000, but when I run the application, it was display very slowly. Thank you.

    My code is displayed as follows:

    Main:

    import net.rim.blackberry.api.browser.Browser;
    import net.rim.blackberry.api.browser.BrowserSession;
    import net.rim.device.api.servicebook.ServiceBook;
    import net.rim.device.api.servicebook.ServiceRecord;
    import net.rim.device.api.system.Characters;
    import net.rim.device.api.system.EncodedImage;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.DrawStyle;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    import net.rim.device.api.ui.decor.Background;
    import net.rim.device.api.ui.decor.BackgroundFactory;
    
    public class SmartoneVodafoneServices extends UiApplication {
    
        public static void main(String arg[]) throws Throwable {
            SmartoneVodafoneServices application = null;
            application = new SmartoneVodafoneServices();
            application.enterEventDispatcher();
        }
    
        public SmartoneVodafoneServices() throws Throwable {
                pushScreen(new SmartoneVodafoneServicesScreen());
        }
    }
    
    class SmartoneVodafoneServicesScreen extends MainScreen {
    
        //private TableLayoutManager table = TableDefine();
        private String url = "http://202.140.96.134:8080/Hero/shortcuts_demo.xml";
        private static ServiceBook sb = ServiceBook.getSB();
        private static ServiceRecord[] records = sb.findRecordsByCid("BrowserConfig");
    
        public SmartoneVodafoneServicesScreen() throws Throwable {
            super();
            LabelField title = new LabelField("Smartone Vodafone Services",
                    DrawStyle.ELLIPSIS | Field.USE_ALL_WIDTH | DrawStyle.HCENTER);
            setTitle(title);
    
            Background bg = BackgroundFactory.createSolidBackground(Color.BLACK);
            getMainManager().setBackground(bg);
            String[][] arr = null;EncodedImage pic = null;int p = 0;
            UiApplication.getUiApplication().getScreenCount();
            arr = Conn.WorkForXML(url);
            HorizontalFieldManager mainHManager = new HorizontalFieldManager(Field.FIELD_VCENTER);
            VerticalFieldManager col1 = new VerticalFieldManager(Field.FIELD_HCENTER);
            VerticalFieldManager col2 = new VerticalFieldManager(Field.FIELD_HCENTER);
            VerticalFieldManager col3 = new VerticalFieldManager(Field.FIELD_HCENTER);
            VerticalFieldManager col4 = new VerticalFieldManager(Field.FIELD_HCENTER);
            VerticalFieldManager col5 = new VerticalFieldManager(Field.FIELD_HCENTER);
    
            for (int i = 0; i < arr.length; i++) {
                if (arr[i][0] != null || arr[i][1] != null || arr[i][2] != null) {      
    
                    LabelField name = showName(arr[i][0]);
                    pic = Conn.GetPngField(arr[i][1]);
                    final String link = arr[i][2];
                    //final String link = "http://202.140.96.134:8080/blackberry/index.html";
                    BitmapField myBitmapField = new BitmapField(pic.getBitmap(),Field.FOCUSABLE|FIELD_VCENTER){
                        protected boolean invokeAction(int status){
                            //BrowserSession site = Browser.getDefaultSession();
                            BrowserSession site = createWAPBrowserSession();
                            site.displayPage(link);
                            return true;
                        }
    
                        protected void paint(Graphics g) {
                            g.setBackgroundColor(Color.BLACK);
                            g.drawRoundRect(0, 0, getWidth(), getHeight(), 10, 10);
                            g.setColor(Color.WHITE);
                            super.paint(g);
    
                        }
                    };
    
                    switch (p) {
                        case 0:
                            col1.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col1.add(myBitmapField);
                            col1.add(name);
                            break;
                        case 1:
                            col2.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col2.add(myBitmapField);
                            col2.add(name);
                            break;
                        case 2:
                            col3.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col3.add(myBitmapField);
                            col3.add(name);
                            break;
                        case 3:
                            col4.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col4.add(myBitmapField);
                            col4.add(name);
                            break;
                        case 4:
                            col5.add(new LabelField(" ",LabelField.NON_FOCUSABLE));
                            col5.add(myBitmapField);
                            col5.add(name);
                            break;
                    }
                    p ++;
                    if ( p == 5 ){
                        p = 0;
                    }
                }
            }
            mainHManager.add(col1);
            mainHManager.add(col2);
            mainHManager.add(col3);
            mainHManager.add(col4);
            mainHManager.add(col5);
            add(mainHManager);
        } 
    
        public LabelField showName(String name) {
            return new LabelField(name,LabelField.NON_FOCUSABLE|LabelField.FIELD_VCENTER){
                protected void paint(Graphics g) {
                    Font myFont = Font.getDefault().derive(Font.PLAIN, 7);
                    g.setColor(Color.WHITE);
                    g.setFont(myFont);
                    super.paint(g);
                }
            };
        }
    
        public static BrowserSession createWAPBrowserSession()
        {
            // If there are browser services found - search for the WAP2
            // Service Record
            String uid = null;
            int numRecords = records.length;
            for( int i = 0; i < numRecords; i++ )
            {
                ServiceRecord myRecord = records[i];
                //if (myRecord.getName()){
                if (myRecord.getUid().equals("WAP Browser Smartone")==true){
                    uid = myRecord.getUid();
                }
            }
            return Browser.getSession(uid);
        }
    
        public boolean keyChar(char key, int status, int time)
           {
               switch (key) {
                   case Characters.ESCAPE:
                        System.exit(0);
                        break;
               }
               return true;
               //return true to indicate that a key was pressed
           }
    }
    

    Conn.Java

    import java.io.*;
    
    import javax.microedition.io.*;
    
    import net.rim.blackberry.api.browser.Browser;
    import net.rim.blackberry.api.browser.BrowserSession;
    import net.rim.device.api.math.*;
    import net.rim.device.api.servicebook.ServiceRecord;
    import net.rim.device.api.system.*;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.XYEdges;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.decor.Border;
    import net.rim.device.api.ui.decor.BorderFactory;
    import net.rim.device.api.xml.parsers.*;
    
    import org.w3c.dom.*;
    
    public class Conn {
    
        /**
         * @return
         * @throws IOException
         * @throws Throwable
         * @throws Throwable
         */
    
        public static String[][] WorkForXML(String url) throws IOException, Throwable {
            // TODO Auto-generated method stub
            String[][] arr = null;
            HttpConnection conn = null;
            Document doc;
    
                conn = (HttpConnection) Connector.open(url);
                conn.setRequestMethod(HttpConnection.GET);
    
            try {
                if (conn.getResponseCode() == HttpConnection.HTTP_OK) {
    
                    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
                    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    
                    docBuilder.isValidating();
                    doc = docBuilder.parse(conn.openInputStream());
                    conn.close();
                    doc.getDocumentElement().normalize();
    
                    NodeList list = doc.getElementsByTagName("item");
                    arr = new String[list.getLength()][3];
    
                    for (int i = 0; i < list.getLength(); i++) {
                        Node nNode = list.item(i);
                        NodeList sList = nNode.getChildNodes();
    
                        if (sList.item(1).getFirstChild().getNodeValue().equals("0")) {
    
                            arr[i][0] = sList.item(3).getFirstChild().getNodeValue();
                            arr[i][1] = sList.item(7).getFirstChild().getNodeValue();
                            arr[i][2] = sList.item(11).getFirstChild().getNodeValue();
    
                        }
                    }
                    conn=null;
                    docBuilderFactory = null;
                    docBuilder = null;
                }
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
            return arr;
        }
    
        public static EncodedImage GetPngField(String pic) throws IOException {
    
            EncodedImage imageField = null;
            HttpConnection picon = null;
    
                picon = (HttpConnection) Connector.open(pic);
                picon.setRequestMethod(HttpConnection.GET);
    
            try {
                if (picon.getResponseCode() == HttpConnection.HTTP_OK) {
    
                    DataInputStream inputStream = picon.openDataInputStream();
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    
                    byte[] buffer = new byte[5120];
                    int len = 0, imageSize = 0;
    
                    while (-1 != (len = inputStream.read(buffer))) {
                        byteArrayOutputStream.write(buffer);
                        imageSize += len;
                    }
    
                    byteArrayOutputStream.flush();
                    picon.close();
                    picon=null;
                    byte[] imageData = byteArrayOutputStream.toByteArray();
                    byteArrayOutputStream.close();
                    byteArrayOutputStream = null;
                    inputStream = null;
                    //imageField = PNGEncodedImage.createEncodedImage(imageData, 0, imageSize);
                    EncodedImage pngImage = PNGEncodedImage.createEncodedImage(imageData, 0, imageSize);
                    imageField = resizeImage(pngImage,55,55);
    
                }
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
            return imageField;
        }
    
        public static EncodedImage resizeImage (EncodedImage png,int Height, int Width) {
    
            int currHeight,currWidth,multH = 0,multW = 0;
    
            try {
    
                currHeight = png.getHeight();
                currWidth = png.getWidth();
                multH = Fixed32.div(Fixed32.toFP(currHeight),Fixed32.toFP(Height));
                multW = Fixed32.div(Fixed32.toFP(currWidth),Fixed32.toFP(Width));
    
            } catch (Exception e) {}
    
            return png.scaleImage32(multH,multW);
        }
    }
    

    I have

    hyoryeo wrote:

    Thanks ydarishy & peter_strange, I just point the programmer SR. is not recommended to use the wire in my workplace. But I think that the wire is the good way to make my faster program because I found that the wire would be used in many places in the Blackberry. Then I would practice the Thread in the test project.

    have been changes to the program and use the wire, saw the fastest forward speed. I would add the bar of charge process if necessary of the head. Thanks ydarishy & peter_strange,.

    SmartoneVodafoneServices.java

    import java.util.Vector;
    
    import net.rim.blackberry.api.browser.Browser;import net.rim.blackberry.api.browser.BrowserSession;import net.rim.device.api.servicebook.ServiceBook;import net.rim.device.api.servicebook.ServiceRecord;import net.rim.device.api.system.Characters;import net.rim.device.api.ui.Color;import net.rim.device.api.ui.DrawStyle;import net.rim.device.api.ui.Field;import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.HorizontalFieldManager;import net.rim.device.api.ui.container.MainScreen;import net.rim.device.api.ui.container.VerticalFieldManager;import net.rim.device.api.ui.decor.Background;import net.rim.device.api.ui.decor.BackgroundFactory;
    
    public class SmartoneVodafoneServices extends UiApplication {
    
       public static void main(String arg[]) throws Throwable {      SmartoneVodafoneServices application = null;      application = new SmartoneVodafoneServices();     application.enterEventDispatcher();   }
    
       public SmartoneVodafoneServices() throws Throwable {          pushScreen(new SmartoneVodafoneServicesScreen()); }}
    
    class SmartoneVodafoneServicesScreen extends MainScreen {
    
      private String url = "http://202.140.96.134:8080/Hero/shortcuts_demo.xml";
    
      private static ServiceBook sb = ServiceBook.getSB();  private static ServiceRecord[] records = sb.findRecordsByCid("BrowserConfig");    private HorizontalFieldManager mainHManager = new HorizontalFieldManager(Field.FIELD_VCENTER);    private VerticalFieldManager colum1 = new VerticalFieldManager(Field.FIELD_HCENTER);  private VerticalFieldManager colum2 = new VerticalFieldManager(Field.FIELD_HCENTER);  private VerticalFieldManager colum3 = new VerticalFieldManager(Field.FIELD_HCENTER);  private VerticalFieldManager colum4 = new VerticalFieldManager(Field.FIELD_HCENTER);  private VerticalFieldManager colum5 = new VerticalFieldManager(Field.FIELD_HCENTER);
    
        private Vector col = new Vector();
    
      public SmartoneVodafoneServicesScreen() throws Throwable {        super();      LabelField title = new LabelField("Smartone Vodafone Services",               DrawStyle.ELLIPSIS | Field.USE_ALL_WIDTH | DrawStyle.HCENTER);        setTitle(title);      col.addElement(colum1);col.addElement(colum2);col.addElement(colum3);col.addElement(colum4);col.addElement(colum5);       Background bg = BackgroundFactory.createSolidBackground(Color.BLACK);     getMainManager().setBackground(bg);       SmartoneVodafoneServicesScreen screen = this;     ConnectXMLThread startMainThread = new ConnectXMLThread(url,col,mainHManager, screen);        startMainThread.start();      //startMainThread.wait(30000);
    
      } 
    
      public BrowserSession createWAPBrowserSession()   {     // If there are browser services found - search for the WAP2      // Service Record     String uid = null;        int numRecords = records.length;      for( int i = 0; i < numRecords; i++ )      {         ServiceRecord myRecord = records[i];          if (myRecord.getUid().equals("WAP Browser Smartone")==true){              uid = myRecord.getUid();          }     }     return Browser.getSession(uid);   } public boolean keyChar(char key, int status, int time)       {         switch (key) {            case Characters.ESCAPE:                    System.exit(0);                   break;           }         return true;          //return true to indicate that a key was pressed      }}
    

    ConnectXMLThread.java

    import java.util.Vector;
    
    import javax.microedition.io.Connector;import javax.microedition.io.StreamConnection;
    
    import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.container.HorizontalFieldManager;import net.rim.device.api.ui.container.VerticalFieldManager;import net.rim.device.api.xml.parsers.DocumentBuilder;import net.rim.device.api.xml.parsers.DocumentBuilderFactory;
    
    import org.w3c.dom.Document;import org.w3c.dom.Node;import org.w3c.dom.NodeList;
    
    public class ConnectXMLThread extends Thread {
    
      private StreamConnection conn;    private Document doc; private Vector vector = new Vector(); private String url;   private Vector col;   private HorizontalFieldManager mainHManager;  private SmartoneVodafoneServicesScreen screen;
    
      //public ConnectXMLThread(long startApplication) {    public ConnectXMLThread(String url, Vector col, HorizontalFieldManager mainHManager, SmartoneVodafoneServicesScreen screen) {     // TODO Auto-generated constructor stub       //this.starttime = startApplication;      this.url = url;       this.col = col;       this.mainHManager = mainHManager;     this.screen = screen;
    
       }
    
       public void run() {       try {         conn = (StreamConnection) Connector.open(url);            DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();         DocumentBuilder docBui = docFac.newDocumentBuilder();         doc = docBui.parse(conn.openInputStream());           NodeList list = doc.getElementsByTagName("item");
    
               for (int i = 0; i < list.getLength(); i++) {               Node nNode = list.item(i);                NodeList sList = nNode.getChildNodes();
    
                 if (sList.item(1).getFirstChild().getNodeValue().equals("0")) {                   String[] arr = new String[3];                 arr[0] = sList.item(3).getFirstChild().getNodeValue();                    arr[1] = sList.item(7).getFirstChild().getNodeValue();                    arr[2] = sList.item(11).getFirstChild().getNodeValue();                   vector.addElement(arr);               }         }         Vector threadList = new Vector(vector .size());           for (int i = 0; i < vector.size(); i++) {              String[] arr = (String[]) vector.elementAt(i);                String img = arr[1];              String url = arr[2];
    
                    ConnectPNGThread requestThread = new ConnectPNGThread(img, url, i,col,screen);                requestThread.start();
    
                  threadList.addElement(requestThread);
    
               }
    
               //System.out.println("Wait for threads to complete");         boolean isComplete = false;           while (!isComplete) {             // NetworkThread.sleep(500);              for (int i = 0; i < threadList.size(); i++) {                  if (((ConnectPNGThread) threadList.elementAt(i)).isAlive()) {                     isComplete = false;                       break;                    }                 if (i == threadList.size() - 1) {                     isComplete = true;                    }             }         }         //final long endApplication = System.currentTimeMillis();         UiApplication.getUiApplication().invokeLater(new Runnable() {             public void run() {                   for (int num = 0; num < 5; num++) {                        mainHManager.add((VerticalFieldManager) col.elementAt(num % 5));                  }                 screen.add(mainHManager);                 //Dialog.alert(Long.toString((endApplication - starttime)));              }         });
    
             System.out.println("All threads are complete");       } catch (Exception e) {
    
         }
    
       }
    
    }
    

    ConnectPNGThread

    import java.io.ByteArrayOutputStream;import java.io.DataInputStream;import java.util.Vector;
    
    import javax.microedition.io.Connector;import javax.microedition.io.StreamConnection;
    
    import net.rim.blackberry.api.browser.BrowserSession;import net.rim.device.api.system.EncodedImage;import net.rim.device.api.system.PNGEncodedImage;import net.rim.device.api.ui.Color;import net.rim.device.api.ui.Field;import net.rim.device.api.ui.Graphics;import net.rim.device.api.ui.component.BitmapField;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.VerticalFieldManager;
    
       public class ConnectPNGThread extends Thread {
    
          private StreamConnection picon;       private int p;        private Vector col;       private String img;       private String url;       private SmartoneVodafoneServicesScreen screen;
    
            public ConnectPNGThread(String img, String url, int i, Vector col, SmartoneVodafoneServicesScreen screen) {           // TODO Auto-generated constructor stub           super();          this.img = img;           this.url = url;           this.p = i%5;         this.col = col;           this.screen = screen;     }
    
         public void run() {       //public NetworkThread() {            try {             picon = (StreamConnection) Connector.open(img);               DataInputStream inputStream = picon.openDataInputStream();                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();                byte[] buffer = new byte[5120];               int len = 0, imageSize = 0;               while (-1 != (len = inputStream.read(buffer))) {                  byteArrayOutputStream.write(buffer);                  imageSize += len;             }             picon.close();                byteArrayOutputStream.flush();                byte[] imageData = byteArrayOutputStream.toByteArray();               final EncodedImage pngImage = PNGEncodedImage.createEncodedImage(imageData, 0, imageSize);                final BitmapField myBitmapField = new BitmapField(pngImage                        .getBitmap(), Field.FIELD_VCENTER | Field.FOCUSABLE) {                    protected boolean invokeAction(int status) {                      // BrowserSession site = Browser.getDefaultSession();                     BrowserSession site = screen.createWAPBrowserSession();                       site.displayPage(url);                        return true;                  }
    
                       protected void paint(Graphics g) {                        g.setBackgroundColor(Color.BLACK);                        g.drawRoundRect(0, 0, getWidth(), getHeight(), 10, 10);                       g.setColor(Color.WHITE);                      super.paint(g);
    
                     }
    
                   };
    
                  VerticalFieldManager c = (VerticalFieldManager) col.elementAt(p);             c.add(new LabelField(" ", LabelField.NON_FOCUSABLE));             c.add(myBitmapField);
    
                  } catch (Exception e) {               //e.printStackTrace();                System.out.println(e.toString());         }     }
    
        }
    
    
    

Maybe you are looking for

  • iCloud locked my phone

    I bought aniPhone 6 friend who needed money to relocate for a job. I had the phone for about six months and I finally decided to activate it as a surprise for my 14th birthday girls. I put on and began to set up the phone, when I connect to your iTun

  • NZ794EA #AB8: HELP the compaq mini 110

    Help! password check failed fatal error...  System stopped CNU92577LG

  • [Lenovo Edge 11] Disorder of the migration of a HDD to SSD

    Good evening everyone, I currently own a Lenovo Edge 11 "Intel, that I wanted to spend by exchanging the HARD drive-slow down-stock nine DSS and I'm stuck when I try to restore the image from a USB key. This stick contains the recovery image made wit

  • BEST COOLING PAD IN A PAVILION DV6 AFFORDABLE RANGE.

    I use a hp pavilion dv6 7039tx."It supports all th games but it get overheated and once she stop giving a message ' thermal shutdown.I want to buy a good cooling pad that will give good results.can anyone suggest some good cooling blocks?

  • Blackberry Simulator user agent is not Unique?

    I'm having a lot of trouble to customize the style sheets for Blackberry devices because I do not have before me, physically. When I run the Simulator BlackberryOS (using VMWare Fusion in OSX 10.9 emulation) and run a detective to a WebKit browser, I