Frusttred after trying for hours - Java.indexoutofbounds

   btnTest.setChangeListener(new FieldChangeListener()
        {
            public void fieldChanged(Field field, int context) {

                try{

                    if ((field instanceof ButtonField) ) {

                         if (btnTest.getLabel().charAt(9)=='S') {

                                ButtonField cbField = (ButtonField) field;
                                String label = cbField.getLabel();
                             if (label=="Approved"){
                                    Dialog.inform("SR is already added to the update queue!");
                                }
                             else{
                                int response = Dialog.ask(Dialog.D_YES_NO,"Are you sure you want to Approve?");
                                if (response == -1){
                                        Dialog.alert(label.substring(9, label.length()) + " Is Not Approved");

                                }
                                else{

                                    s.getData("http://m.zeo.zajil.com/test/Search.aspx?cat=SR_Approve&user="+t1+"&Sr_no="+label.substring(16, label.length()).trim()+"&BBPIN="+pinStr);
                                    Dialog.alert(label.substring(9, label.length()) + " Is Approved");
                                    cbField.setLabel("Approved");
                                }
                             }
                         }
                         else if (btnTest.getLabel().charAt(9)=='R') {

                                ButtonField cbField = (ButtonField) field;
                                String label = cbField.getLabel();
                             if (label=="Approved"){
                                    Dialog.inform("RFP is already added to the update queue!");
                                }
                             else if (label=="REJECTED"){
                                 Dialog.inform("RFP is Already added to Reject List");
                             }
                             else{

                                Dialog d = new Dialog("Are you sure you want to Approve this RFP?",
                                          new String[] {"Yes", "No", "Cancel"},
                                          new int[] {1, -1, 0},
                                          0, null); 

                                d.doModal();
                                int result = d.getSelectedValue();
                                if ( result == 0 ) {

                                } else
                                if ( result == 1 ) {

                                    String stt;
                                    stt="http://m.zeo.zajil.com/test/Search.aspx?cat=RFP_Approve&&user="+t1+"&&BBPIN="+pinStr+"&&RFPNO="+label.substring(17, label.length()).trim();
                                    s.getData(stt);
                                    Dialog.alert(label.substring(9, label.length()) + " Is Approved");
                                    //cbField.setLabel(label.substring(9, label.length()));

                                    cbField.setLabel("Approved");
                                    //cbField.setFont(fontTitle);
                                } else {
                                    Dialog.alert(label.substring(9, label.length()) + " Is Rejected");
                                    UiApplication.getUiApplication().pushScreen(new PopUp("http://m.zeo.zajil.com/test/Search.aspx?cat=RFP_Reject&user="+t1+"&BBPIN="+ pinStr +"&RFPNO="+label.substring(17, label.length()).trim()+"&remarks="));
                                    cbField.setLabel("REJECTED");

                                }
                             }

                         }

                         if (btnTest.getLabel().charAt(9)=='T') {

                                ButtonField cbField = (ButtonField) field;
                                String label = cbField.getLabel();
                             if (label=="Approved"){
                                    Dialog.inform("Travel Request is already added to the update queue!");
                                }
                             else if (label=="REJECTED"){
                                 Dialog.inform("Travel Request is Already added to Reject List");
                             }
                             else{

                                Dialog d = new Dialog("Are you sure you want to Approve this Travel Request?",
                                          new String[] {"Yes", "No", "Cancel"},
                                          new int[] {1, -1, 0},
                                          0, null); 

                                d.doModal();
                                int result = d.getSelectedValue();
                                if ( result == 0 ) {

                                } else
                                if ( result == 1 ) {

                                    String stt;
                                    stt="http://m.zeo.zajil.com/test/Search.aspx?cat=Travel_approve&user="+t1+"&BBpin="+pinStr+"&TravelId="+label.substring(19, label.length()).trim();
                                    s.getData(stt);
                                    Dialog.alert(label.substring(9, label.length()) + " Is Approved");
                                    cbField.setLabel("Approved");
                                } else {
                                    Dialog.alert(label.substring(9, label.length()) + " Is Rejected");
                                    UiApplication.getUiApplication().pushScreen(new PopUp("http://m.zeo.zajil.com/test/Search.aspx?cat=Travel_reject&user="+t1+"&BBpin="+pinStr+"&travelID="+label.substring(19, label.length()).trim()+"&remarks="));
                                    cbField.setLabel("REJECTED");

                                }
                             }

                         }

                    }
                }catch(Exception ex){

                    //Dialog.alert("Exception:"+ ex.toString());

                }
            }

        }

        );

It works like a beauty when I click on the button with the a ' and 't'

but I do not know why it gives indexoutofbound exceptions for ' R

Sorry for the long code snippet

It's really frustrating

any help / sample code / links / advice would be highly appreciated

Rgds

Nadir Firfire

You seem to say that get you an index of the limits on this line:

(btnTest.getLabel (.charAt) (9) == 'R')

I mustr admit I struggle with this - it seems that the same label and indexes have been used before.

May I suggest that you rewrite your code a little bit which will make it easier to read and debug, specially for this problem.

First think is in this code, we have no idea of what btnTest is another logic it seems defines this, but it does not see, as that button, you expect to be at the point, i.e. one that was pressed.  If you can change your code as follows:

Amend the beginning of

If ((field ButtonField instanceof)) {}
If (btnTest.getLabel (.charAt) (9) ==' is)

TO

If ((field ButtonField instanceof)) {}

btnTest = field (ButtpnField);

char charToTest = btnTest.getLabel (.charAt) (9);

If (charToTest == the of ')

Then everywhere wherever you have
If (btnTest.getLabel (.charAt) (9) ==' is)

replace it with

If (charToTest == the of ')

This updates the line you say causes index exceptin in a way that can not get an exception in the index, so this should stop the problem.

Also, in your code, you have a number of lines like:

If (label == "REJECTED") {}

You know that it is probably not to do what you want to compare a String, you must use the equals method, i.e.

If (label.equals ("REJECTED")) {}

Finally, Simon is correct, the networking on the event Thread will cause your program to fail on a device.

HOEP that helps.

Tags: BlackBerry Developers

Similar Questions

  • My iPod does not not after charging for hours

    My ipod does not not after charging for hours

    More details would be helpful please. What have you tried to do? What you are experiencing?

  • Ive been trying for hours now, but illustrator wont allow me to create a clipping mask

    I created the spirit logo attached the pen tool. I then cut the Central Wick using the form generator tool.

    I imported it into a new document with an object/image that I want to hang it. I select the two go to object > clipping to mask.

    The two objects is suddenly off and I do not see the fill / no STROKE of the icons. If this does not happen then There nature and all just say "cannot make a clipping mask.

    This has been bothering me for a few days now.

    Anyone have any ideas?

    Thanks in advance.

    Herms-ra.

    You can do so quite different or similar with masks of Cliping, without or with background color purple/note/smoke.

    Note: There was an error in the first proposal in post #18: in step 5) you must select C) (purple/note/smoke color background to cut of the) instead of d) (the underlying texture of parties drops black), sorry, I just spotted it.

    You can (reusing a part of the first proposal):

    (1) return to, or start from scratch, with the following basic elements (starting with this stacking order):

    (A) the compound path, forming the dripping inner circle party black (in A).

    (B) the compound path, forming the external parties dripping with black,

    (C) the color purple/note/smoke to cut background

    (D) the underlying texture parts of gout black,.

    (E) the underlying texture of letter parts internal;

    Select 2) A) and B) and copy both to the top of the stacking order, then release both Compound paths and remove the inner path from A) and the external path of B), then turn them into a new compound path, consisting of forms of internal letters (you can use Pathfinder > less first plan or object > compound path > make);

    (((3) E move) (the underlying texture of parts internal letter) up just below the new path composed of 2), select both and opposition > clipping mask > make, and then to hide;

    (Select 4 (A) (composite route forming the dripping inner circle in black (A)) and b the compound path forming the outer circle dripping parts black) and object > compound path > make;

    ((5) select the combination of 4) and D) (the underlying texture of parties drops black) and object > clipping mask > make.

    (Show 6) 3).

    (C) the note/violet/smoky colored backgroun, if keep you it, or any other background will be visible everywhere where it is not covered.

  • Creative cloud will not be installed. I tried for hours. I deleted, retried, uninstalled, to the point where I can do it blindfolded.

    It must be simple people. I wouldn't have to redraw a computer of 3500 dollars to install a piece of software so I can use the software I paid a year. (premiere pro). Since Marcus offers no telephone support and all I've been advised to do so far is remove a lot of things that made it worse, I want my money.

    Here are the various support channels:

    Phone: support phone | Orders, returns of trade

    Chat support: Customer Contact

    Concerning

    Stéphane

  • After installing CC and trying to open the CC Isee the framework and a revolving around the circuit for hours.

    After installing and starting I see that the framework with a rotating Tower circuit for hours. No points for applications or any other sign.

    What I've done wrong?

    best regards from Ferdinand

    Hi ferdinand,.

    Please see the below help document to solve the problem:

    Does not open App | Wheels of progress turn continuously

    Kind regards

    Sheena

  • Have tried for almost an hour and a half get on the cat through three trials to resolve my issue of access 4.0 profile

    Have tried for almost an hour and a half to find someone to answer chat and adopted a few times. Cannot access my profile to work after yesterday, I downloaded 4.0. Telling me I'm not online but I'm not, and the box is unchecked. Have tried restarting several times, re - install several times without success. Did not help chat or answers here. But I need to use it for work. Worked perfectly in 3. recent ost. Help!

    One possible cause is security software (firewall) that blocks or limits Firefox or plugin-container process without informing you, possibly after the detection of changes (update) for the Firefox program.

    Delete all rules for Firefox in the list of permissions in the firewall and leave your firewall again ask permission to get full unlimited access to the internet for Firefox and the plugin-container.

    See:

  • Vista crashes after using it for a few minutes and then does not start (after a few hours - it starts and again the same problem)

    I'll have this weird problem and did not find the problem. Suddenly my laptop (Lenovo Y710 - 4 GB RAM - Windows Vista Home Premium 32 bit) crashes after a few minutes of activity, Vista freezes. CTRL + Alt + Delete does not work. If I force close to the bottom and then try to restart, it do display anything. I tried to start in safe mode, but after pressing f8 and it only beeps and still doest appear anyting on screen you. If I try to start the laptop after a few hours it starts again and minutes it freezes again. I noticed this problem for the first time when using RDP to my desktop, but it wasn't the first time I've done RDP. I have not installed new hardware or drivers. Am not able to nail the question, would appreciate any help.

    Thank you.

    This is no doubt hardware failure. The laptop could be overheating and/or other components could be involved. Contact Lenovo technical support or take to a competent local computer Tech do not use a type of BigComputerStore/GeekSquad of the place.

    If you have a pretty good level of computer skills, you can test some components yourself although it is more difficult to make accurate material on a laptop computer troubleshooting.

    http://www.elephantboycomputers.com/page2.html#Hardware_Tshoot
    MS - MVP - Elephant Boy computers - don't panic!

  • Constant, failure to update, tried for several hours technical support help, recommended full could not uninstall and reinstall, install now freezes at 74%

    No, I'm really lost and I don't know what else to do and I'm not anxious to be on technical support for several hours again.

    My problem was originally that the hotfix update released last November failed to install. I ask on the forum for help, I got some good suggestions but nothing worked. Since Photoshop still worked I've just postponed the issue.

    Several months later, I decided to try everything I can to get the update to work. Created another Admin removed tried Photoshop by reinstalling. Still no. Tried several different things that do not work.

    I finally got with technical support, I allow access to my computer. They spent several hours uninstalling and reinstalling and not as I did. They did get more advances but after almost 4 hours, I was tired of looking at Photoshop do not settle.

    They said they have done all the troubleshooting that they could, and that the best option was to simply uninstall all Adobe and then reinstall it.

    I did tonight. Following the instructions here are using the Adobe Creative Cloud cleaning tool to solve installation problems

    Now I'm stuck with freezing to 74% on installation of Photoshop. Further research led me to this Adobe CC 2015 Direct Download Links: Creative Cloud 2015 Release | ProDesignTools

    Unfortunately, at the start of the installation, it cannot connect to the internet. I know that my connection is working because I can watch sites Web, but stops install on it. I try connecting later button and he asks a serial Code. I have CC so I is not a serial Code and may not try to generate a.

    If Photoshop used to work but not to update. Now it doesn't work at all.

    I'm desperate, I need help to solve this problem. Suggestions, ideas about why this is happening and what I can do to work around it? My number is 0187559333

    Finally managed to do work. I also tried the update and it worked also. It's been a long day.

    On the downloaded installation, there is an option to install a trial version or install a licensed version. The property stored fault due to the weird internet connection being found and the absence of an activation code. But the installation of the trial worked. Has exceeded the dreaded 74% and kept things.

    The end of installation, I opened creative cloud and looked at the applications tab. The update appeared later. I clicked top and too installed completely.

    Now I just hope the trial realizes that I have a legitimate CC account and that it does not lock me in the coming days.

  • My iMac has been slain on the wheel that turns for hours after I entered my Apple ID in the Setup

    My iMac has been slain on the wheel for hours after I entered my Apple ID in the installation program do I do?

    Hold the power button until the screen goes black.

    Wait at least 10 seconds, then press power once to turn back on.

    If you still have problems, boot in Safe Mode boot Safe Mode.A removes the system caches that can help.

    Upper left corner of your screen, click on the Apple  > Shut Down.

    After your Mac stops, wait 10 seconds, then press the power button.

    As soon as you hear the startup tone, hold down the SHIFT key. You must press the SHIFT key as soon as possible once you hear the startup tone, but not before.

    Release the SHIFT key when you see the gray Apple logo and progress indicator.

    Once you are in Mode without failure, return to the menu Apple . In the drop-down list, click: reboot

    On Safe Mode

  • Firefox regularly (every 8 to 15 seconds) freezes for 1-3 (in seconds) after a half hour of work

    Firefox crashes on a regular basis (every 8 to 15 seconds) for 1 to 3 seconds after half an hour of work. I freshly installed my windows and firefox (without extensions), but the hook has yet occurred. Don't know how to solve this problem. Maybe it's a memory problem? (I have 4 GB of RAM, which should be enough). When it crashes, it leaves to scroll through, write or do something else, but if I try to do, he says, but after a few seconds. This happens regularly, it's very annoying, especially when it crashes looking at youtube - video stops, turn on audio and a video catches up with a video after a few seconds. Thank you very much for the help.

    This has happened

    Each time Firefox opened

    Is very long

    Try running Firefox in questions to troubleshoot Firefox in Safe Mode. If that fixes it, disable extensions 1 by 1 to find the culprit.

  • I tried for AN HOUR to find a way to put the two different fonts on the same line

    Pages is crap. I tried for AN HOUR to find a way to put the two fonts on the same line, even if I highlight 1 WORD, the whole line changes (if you know how to do that please tell me, I'll me CRAZY!). Wouldn't recommend, that Word is 100 x better and easier to use

    < published by host >

    Hi varn,.

    Seems to work here (Pages of screen capture):

    Select (highlight) the text you want to change. Click on the Format brush, and then click Style. Choose the font you want to use.

    The example above is in the text layer. I also tried in a text box and a table cell.

    I also tried to change the font for a single word of a line of text in Pages for iOS. The police has changed to the selected word, while the rest of the line remained in the police, he had previously.

    Cannot test it in 5 Pages, because I have not installed. The above example is Pages ' 09.

    It is possible that you have applied to a paragraph Style, what would change everything in the paragraph containing the insertion point.

    Kind regards

    Barry

    PS: MS Word is available for OS X, if you feel the need to switch.

    B

  • I guess I tried to get to ICloud, and he has been churning for hours. How can I stop it? It will not allow a click anywhere in the window. And I can't seem to all other system preferences. It just goes back to this window. Thank you.

    I guess I tried to get to the ICloud, and he has been churning for hours.  How can I stop it? The Cancel button is grayed out. And I have ack

    are unable to other options in system preferences. It just brings back me to the window to iCloud churning. Thank you.

    What you're trying to do with iCloud, exactly? Have you tried pressing Command + Option + escape to force quit?

    See you soon,.

    GB

  • My slowsdown LV after running for several hours program

    Hello

    Could you please help me in my problem explained below.

    My experiences require to run the program from LV for 2-3 days in a stretch of collecting data to 10 Hz speed using a release configuration. But after running for a few hours, the program slows down, not buying the data with the same speed. If I restart the program again, it works very well with the required speed.

    I have LV v4.0.1 running in my Windows 2000 operating system. I have the card PCI-GPIB connected to Lecroy 8901 GPIB interface for data acquisition. I also LAB - PC + to control some engines.

    I have NEITHER-DAQ 6.6, NI-VISA for windows 95 / NT installed in my system.

    I thought that the problem could be my low end computer and recently updated with motherboard relatavely high speed and RAM. But the problem is still there.

    I have attached my program with this message file.

    valueble suggestions are greatly apprecited.

    Thank you.

    You generate data for display and it makes your system slow.

    Keep your smaller screen and write data on the disk.

  • I'm trying to update my ipad (first edition) to the new version and after about an hour, I get a message that says unable to finish because the network has expired.

    I'm trying to update my ipad (first edition) to the new version and after about an hour, I get a message that says unable to finish because the network has expired.  How can I fix it?

    Original title: network programs network networking Internet Web site Site Web Web Site URL

    Hello

    You need to support iPad not Microsoft.

    iPad - media choices
    http://www.Apple.com/support/

    iPad - Support
    http://www.Apple.com/support/iPad/

    iPad - communities (Forums)
    https://discussions.Apple.com/index.jspa

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • win xp sp3 restart after trying to install edimax ps-1216u for printer laserjet p1102

    win xp sp3 restart after trying to install edimax ps-1216u for printer laserjet p1102
    I have the printer installed that tried to install edimax ps-1216u and when it tries to install the printer, the computer restarts

    Problem solved! I have disabled smart installation with SIUttility for this computer. I have manually installed the printer by adding the port tcp/ip standard and all is ok now.

Maybe you are looking for

  • Printing of Excel file is missing a few horizontal grid lines

    WXP Pro Sp3, MS Office Pro 2003, ENVY 4500 Printer.  When I print Excel files, some grid lines are missing.  If I remove the "Wrap text" option in all cells, all the lines of the grid print.  This is not a solution (readability-wise), but indicates t

  • Apple TV 4th generation very slow to load movies (MP4)

    I get a 4th generation Apple TV to replace my old Gen 3. When I try to load a movie from my iTunes Library (on my Mac Mini), it really takes a lot of time to start the movie or it doesn't start at all. This unit is connected to the same network as my

  • I can adjust the paper supply voltage

    When I print a project my HP Deskjet 6540 will sometimes spring from 2 pages at a time and then that ruin my numbered pages as I print on both sides of the paper? Thank you.

  • HP Deskjet 3740: Drivers for printer retired

    I can't find the drivers to download for the 3740 Deskjet to my new Surface, running Windows 10. Anyone know where to find the printer dirvers?

  • Screen unwanted rotation

    I have spend vacuuming my keyboard and the screen turned sideways (rotated 90 degrees to the left) inadvertently. How can I restore it?