Illegal state exception reading MCC

Hello

I use the method above to read MCC

This is a good model for the treatment of the "start-up" which should mean that you can get your information from the Radio, once the device has started successfully.

http://supportforums.BlackBerry.com/T5/Java-development/write-safe-initialization-code/Ta-p/444795

Tags: BlackBerry Developers

Similar Questions

  • Illegal state Exception when running the code at startup

    Here's my main method:

        public static void main(String[] args)
        {
            if (args.length == 1 && args[0].equals("startup"))
            {
                Criteria locationCriteria = new Criteria();
                locationCriteria.setCostAllowed(false);
                LocationProvider mlocationProvider;
                Location mLocation = null;
                try
                {
                    mlocationProvider = LocationProvider
                            .getInstance(locationCriteria);
                    mLocation = mlocationProvider.getLocation(-1);
                }
                catch (LocationException e) {
                }
                catch (InterruptedException e) {
                }
                QualifiedCoordinates mQC = mLocation.getQualifiedCoordinates();
            }
            else
            {
                MyApp theApp = new MyApp();
                theApp.enterEventDispatcher();
            }
        }
    

    The method

     mlocationProvider = LocationProvider.getInstance(locationCriteria); 
    

    throws the illegal state exception

    When I check the debug information, I found this exception are thrown to the line when he calls Application.getApplication ();

    When I move this code to run in a normal life to screen it works fine. !

    Any help?

    There may be a number of issues here:

    (1) until your Application is actually running, you can't really do any processing.  Your Application does not start running until you

    'enterEventDispatcher() '.

    Hand, all you should do is instantiate your Application.  Manufacturer of your Application should not do anything complicated either, since it works as part of main().

    You can do some activities, for example to add listeners, in main() code that is, in some respects, unfortunate because it lulls people into thinking they can do anything.  ,

    (2) get the location as you do, is a blocking call.  If you need to do it on a background Thread.  You c a get away with that on the Simulator because GPS simulated returns immediately with a location.  So it does not actually block.  But on a real device, code as you can force your application to break.

    (3) you seem to try to do something in the commissioning.  You must be aware, this start-up up is called as part of the start-up of the device and before the unit is fully active.  In fact, I think on a real device that this code will fail because the device is not ready to provide a location in the beginning upward.

    You will find find article, informative and useful for (1) and (3).

    http://supportforums.BlackBerry.com/T5/Java-development/write-safe-initialization-code/Ta-p/444795

    I suspect you want to start and get a location at first upward, in which case you might find this useful:

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-background-application/Ta-p/445226

  • By clicking on the button "return" gives illegal state exception

    Hello

    In my app, when I'm clicking on I show a dialog box. and when I am pressing Yes in the dialog box, it gives me the illegal state exception. But I want to return to the previous screen. If I'm clicking on menu and then clicking Close, and then it goes back to the previous screen. Here is my code:

    public boolean keyDown(int keycode, int time) {
    
            if (Keypad.KEY_ESCAPE == Keypad.key(keycode)) {
                int result = Dialog.ask(Dialog.D_YES_NO, "Do you want to edit the list?");
                if (result == Dialog.YES)
                {
                    try
                    {
                        UiApplication.getUiApplication().popScreen(this);
                    }
                    catch (Exception e)
                    {
                        e.printStackTrace();
                    }
    //              onClose();
                }
                else
                {
                    return true;
                }
            } // end if
    
            return false;
        }
    

    Please help me...

    Same question in StackOverFlow:

    Dear arindamhit,

    When you are clicking back into the device and then by default button the onclose() method is called. So try to do like this;

    protected boolean onSavePrompt()
    {
        return true;
    }
    
    public boolean onClose()
    {
        int choose=Dialog.ask(Dialog.D_YES_NO, "Close the screen");
        if(choose==Dialog.YES)
        {
            return super.onClose();
        }
        return true;
    }
    

    It's the best way; If you use like the one above you might get a problem; It is:

    *) If you use this method on the first screen, then according to your code when popup screen then there is no screen in the battery display (because it's the first screen); So you could get this kind of problem;

    Try this one;

  • JavaFX binding throws illegal state Exception: not on the thread of Application FX

    Hi all

    I am updating a label of a task using bindings.

    However, when I 'Bind' the label text property with a property of the task, Illegal state exception string is thrown. Saying: this is not not on the thread of JavaFX.

    The Exception occurs whenever I try to set the property of the task of the Interior string.

    Please do not suggest to use the platform. RunLater(). I want to do this through links as the values I am trying to display in the label (later on) could change too frequently, and I don't want to flood the queue of the thread of the user interface with executable objects.

    Please let me know what I'm doing wrong and what I need to change to make it work properly with links. (I'm new to links and concurrency JavaFx API)

    Here is my Code.

    public class MyTask extends Task<String>{
    
        MyTask(){
           System.out.println("Task Constructor on Thread "+Thread.currentThread().getName());
    
    
        }
        private StringProperty myStringProperty = new SimpleStringProperty(){
            {
                System.out.println("Creating stringProperty on Thread "+Thread.currentThread().getName());
            }
        };
        private final void setFileString(String value) {
            System.out.println("Setting On Thread"+Thread.currentThread().getName());
            myStringProperty.set(value); }
        public final String getFileString() { return myStringProperty.get(); }
        public final StringProperty fileStringProperty() {
            System.out.println("Fetching property On Thread"+Thread.currentThread().getName());
            return myStringProperty; }
        
        @Override
        public String call() throws Exception{
            System.out.println("Task Called on thread "+Thread.currentThread().getName());
    
    
           for(int counter=0;counter<100;counter++){
               try{
               setFileString(""+counter);
               }catch(Exception e){
                   e.printStackTrace();
               }
               Thread.sleep(100);
               System.out.println("Counter "+counter);
           }
           return "COMPLETED";
        }
    }
    
    
    public class MyService extends Service<String> {
    
    
        MyTask myTask;
    
        public MyService(){
            System.out.println("Service Constructor on Thread "+Thread.currentThread().getName());
            myTask=new MyTask();
        }
    
        @Override
        public Task createTask(){
            System.out.println("Creating task on Thread "+Thread.currentThread().getName());
            return myTask;
        }
    
    }
    
    
    public class ServiceAndTaskExperiment extends Application {
        @Override
        public void start(Stage stage) throws Exception {
            Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
        }
        public static void main(String[] args) {
            launch(args);
        }
    }
    
    
    public class SampleController implements Initializable {
        @FXML
        private Label label;
    
        @FXML
        private void handleButtonAction(ActionEvent event) {
            System.out.println("You clicked me!");
            myTestService.start(); //This will throw out exceptions when the button is clicked again, it does not matter
        }
    
        MyService myTestService=new MyService();
        @Override
        public void initialize(URL url, ResourceBundle rb) {
            label.setText("Hello World!");
            //adding the below Line causes the exception
            label.textProperty().bind(myTestService.myTask.fileStringProperty()); //removing this line removes the exception, ofcourse the label wont update.
        } 
    }
    //sample.fxml
    <?xml version="1.0" encoding="UTF-8"?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    
    
    <AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml" fx:controller="serviceandtaskexperiment.SampleController">
        <children>
            <Button layoutX="126" layoutY="90" text="Click Me!" onAction="#handleButtonAction" fx:id="button" />
            <Label layoutX="126" layoutY="120" minHeight="16" minWidth="69" fx:id="label" />
        </children>
    </AnchorPane>
    
    
    
    

    And it is the output with links on:

    Output: when the link is activated label.textProperty () .bind (myTestService.myTask.fileStringProperty ());

    Service on JavaFX Application Thread constructor

    Creating string on thread JavaFX Application Thread

    Task, Builder on JavaFX Application Thread

    Get the property on request ThreadJavaFX wire

    You clicked me!

    Creating a task on a thread Thread Application JavaFX

    Task called threadThread-4

    Setting on ThreadThread-4

    java.lang.IllegalStateException: not on the application thread FX; currentThread = Thread-4

    at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:237)

    at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:398)

    to javafx.scene.Parent$ 1.onProposedChange(Parent.java:245)

    at com.sun.javafx.collections.VetoableObservableList.setAll(VetoableObservableList.java:90)

    at com.sun.javafx.collections.ObservableListWrapper.setAll(ObservableListWrapper.java:314)

    at com.sun.javafx.scene.control.skin.LabeledSkinBase.updateChildren(LabeledSkinBase.java:602)

    at com.sun.javafx.scene.control.skin.LabeledSkinBase.handleControlPropertyChanged(LabeledSkinBase.java:209)

    to com.sun.javafx.scene.control.skin.SkinBase$ 3.changed(SkinBase.java:282)

    at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:107)

    to com.sun.javafx.binding.ExpressionHelper$ SingleChange.fireValueChangedEvent (ExpressionHelper.java:196)

    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:100)

    at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:121)

    at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:128)

    in javafx.beans.property.StringPropertyBase.access$ 100 (StringPropertyBase.java:67)

    to javafx.beans.property.StringPropertyBase$ Listener.invalidated (StringPropertyBase.java:236)

    to com.sun.javafx.binding.ExpressionHelper$ SingleInvalidation.fireValueChangedEvent (ExpressionHelper.java:155)

    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:100)

    at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:121)

    at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:128)

    at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:161)

    at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:67)

    to serviceandtaskexperiment. MyTask.setFileString (MyTask.java:24)

    to serviceandtaskexperiment. MyTask.call (MyTask.java:36)

    to serviceandtaskexperiment. MyTask.call (MyTask.java:11)

    to javafx.concurrent.Task$ TaskCallable.call (Task.java:1259)

    at java.util.concurrent.FutureTask.run(FutureTask.java:262)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:724)

    Output with links removed: (label will not be updated)

    Service on JavaFX Application Thread constructor

    Creating string on thread JavaFX Application Thread

    Task, Builder on JavaFX Application Thread

    You clicked me!

    Creating a task on a thread Thread Application JavaFX

    Task called threadThread-4

    Setting on ThreadThread-4

    Counter 0

    Setting on ThreadThread-4

    1 meter

    Setting on ThreadThread-4

    2 meter

    Setting on ThreadThread-4

    If myStringProperty is bound to the textProperty of etiquette, you can only change it on the Thread of the JavaFX Application. The reason is that change its value will result in a change of the label, and changes of live parts of the graphic scene cannot be performed on the Thread of the JavaFX Application.

    Task and Service classes expose a messageProperty you could use here. The Task class has a updateMessage (...) method that changes the value of the message on the Thread of the JavaFX Application property. It also merges calls in order to prevent the flooding of this thread. If you could do the following in your MyTask.call () method:

    updateMessage(""+counter);
    

    and then in your controller just do

    label.textProperty().bind(myTestService.messageProperty());
    

    If you don't want to use the messageProperty for some reason any (for example you are already using it for something else, or you want to make something similar to a property that is not a string), you must merge the updates yourself. What follows is based on the source code of the task:

    public class MyTask extends Task {
    
         // add in the following:
        private final AtomicReference fileString = new AtomicReference<>();
    
        private void updateFileString(String text) {
            if (Platform.isFxApplicationThread()) {
                setFileString(text);
            } else {
                if (fileString.getAndSet(text) == null) {
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            final String text = fileString.getAndSet(null);
                            MyTask.this.setFileString(text);
                        }
                    });
                }
            }
        }
    
       // Now just call updateFileString(...) from your call() method
    }
    
  • see URLEncodedPostData.getBytes () and illegal state Exception

    Hi, expert,

    recently when I tried to understand the device encryption, I discovered my starts http grave failed when the device is locked and the encryption is enabled. After the addition of debugging information more, I finally discovered that the exception is thrown to the URLEncodedPostData.getBytes () with IllegalStateException, here is a part of the stack trace:

      IllegalStateException
        No detail message
        net_rim_cldc-11(4DE8751A)
         PersistentContent
         decode
         0x8E80
        net_rim_cldc-11(4DE8751A)
         PersistentContent
         decode
         0xB1FC
        net_rim_cldc-11(4DE8751A)
         PersistentContent
         decode
         0xB18A
        net_rim_bb_browser_lib(4DE8802C)
         URLEncodedFormData
         toString
         0xB6C9
        net_rim_bb_browser_lib(4DE8802C)
         URLEncodedFormData
         getBytes
         0xB6B2
        net_rim_bbapi_browser(4DE88041)
         URLEncodedPostData
         getBytes
         0x411
    

    Then I did some search on the forum, I found this link, and that is exactly the same as what I saw: http://supportforums.blackberry.com/t5/Java-Development/URLEncodedPostData-getBytes-and-Illegal-Stat... As I saw no explanation on this thread, I just open this post to see if there is any explanation about it.  I guess that fi that we can't work around this problem, we would have to write code ourselves url code.

    This proximity. Work of my own URL encoding code which is pretty easy to code.

  • «"" «... Illegal state exception»»» " Help!

    Here's my situation.

    I have an A screen that has a button and an ObjectListField and a button. Initially, the object list field contains a list of strings.

    What is push the button a new popup window appears, it contains a text field and a button. I use the display of the text field to get the input of the chain of the user and when the user presses the button, the precious screen containing the ObjectListField appears with the updated value.

    Here is my code

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

    you manage the ESC but will also run great, it means that the screen is closed twice.

    put in a return after that manipulation of the ESC key should solve the problem.

  • JVM 104 - Illegal Argument Exception (wait, what?)

    Friends and enemies,

    I am the developer of a BlackBerry app that works very well for over a year.  All of a sudden, I'm going to run the Simulator, and I get an exception error Uncaght JVM (not on the launch, but medium-term), specifically, the JVM 104 illegal Argument Exception.  I did not any changes to the code in > 3 months, my last run of the application on the Simulator was a week ago.

    This is where it gets crazy... If I create a new project in Eclipse using the code EXACT EVEN the above request, the Simulator works perfectly.  What could have happened to my configuration of a project that builds an illegal Exception of Argument?

    I ran clean.bat on all my simulators. The only change I made on my test machine is to install Adobe Photoshop CS5 (shouldn't really affect anything).

    All the world has already seen this problem?

    Help, please

    JRT

    Oudu a few hours and several breakpoints, I found the problem. Apparently, update a GaugeField using .setValue (int) can throw an Exception of the illegal Argument? But only once a year. I don't know why it was a problem now, the code has been stagnant...?

    SOLUTION:

    try {}

    Update GaugeField

    }

    catch (IllegalArgumentException foo)

    {

    }

    BOOYA! FTW

  • Java.lang.Illegal argument exception

    Dear Sir

    I have the below who worked after I made a few changes, I started getting this error:

    "java.lang.illegal argument exception".

    any help is highly appreciated

    Zeo package;

    import java.util.Calendar;
    import java.util.Date;
    import java.util.TimeZone;
    Import net.rim.device.api.i18n.SimpleDateFormat;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.FieldChangeListener;
    Import net.rim.device.api.ui.Font;
    Import net.rim.device.api.ui.Ui;
    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.device.api.ui.component.ButtonField;
    Import net.rim.device.api.ui.component.Dialog;
    Import net.rim.device.api.ui.component.LabelField;
    Import net.rim.device.api.ui.component.SeparatorField;
    Import net.rim.device.api.ui.container.HorizontalFieldManager;
    Import net.rim.device.api.ui.container.MainScreen;
    Import net.rim.device.api.ui.container.VerticalFieldManager;

    Home page of class extends screen
    {
    HorizontalFieldManager _fieldManagerBottom1, _fieldManagerBottom2, _fieldManagerBottom3, _fieldManagerBottom4, _fieldManagerBottom5, _fieldManagerBottom6, _fieldManagerBottom7;
    ButtonField btnSo, btnPendingSo, btnOpenTT, btnPendingTT, btnTop50So, btnTop50TT;
    LabelField lblSo, lblPendingSo, lblOpenTT, lblPendingTT, lblTop50So, lblTop50TT;
    Do police = Font.getDefault ().derive(Font.PLAIN,5,Ui.UNITS_pt);
    S ServerConnection = new ServerConnection();
    String data = s.displayData ("http://m.zeo.zajil.com/BB/Default.aspx");
    splitString spt = new splitString();
    DisplayData String().
     
    HomePage()
    {
    Thread postnameThread = new Thread (new ServerConnection());
    postnameThread.start ();
       
    LabelField title = new LabelField ("Zajil BlackBerry Edition", LabelField.ELLIPSIS: ") LabelField.USE_ALL_WIDTH);
    setTitle (title);
       
       
          
    HorizontalFieldManager _fieldManagerTop;
    VerticalFieldManager _fieldManagerMiddle;
       
      
    _fieldManagerTop = new HorizontalFieldManager();
    _fieldManagerMiddle = new VerticalFieldManager();
    _fieldManagerBottom1 = new HorizontalFieldManager();
    _fieldManagerBottom2 = new HorizontalFieldManager();
    _fieldManagerBottom3 = new HorizontalFieldManager();
    _fieldManagerBottom4 = new HorizontalFieldManager();
    _fieldManagerBottom5 = new HorizontalFieldManager();
    _fieldManagerBottom6 = new HorizontalFieldManager();
    _fieldManagerBottom7 = new HorizontalFieldManager();
      
    during the initialization of the labels
    lblSo = new LabelField (new LabelField ("So New"));
    lblPendingSo = new LabelField (new LabelField ("waiting So"));
    lblOpenTT = new LabelField (new LabelField ("open disturbance"));
    lblPendingTT = new LabelField (new LabelField ("pending Tickets"));
    lblTop50So = new LabelField (new LabelField ("TOP 50 SO Cust"));
    lblTop50TT = new LabelField (new LabelField ("TOP 50 Cust TT"));
       
    During the initialization of the buttons
    btnSo = new ButtonField("");
    btnSo.setFont (do);
       
    btnPendingSo = new ButtonField("");
    btnPendingSo.setFont (do);
       
    btnOpenTT = new ButtonField("");
    btnOpenTT.setFont (do);
       
    btnPendingTT = new ButtonField("");
    btnPendingTT.setFont (do);
       
    btnTop50So = new ButtonField("");
    btnTop50So.setFont (do);
       
    btnTop50TT = new ButtonField("");
    btnTop50TT.setFont (do);
       
    displayData = spt.split (data, ';');
       
    for (int i = 0; i)<>
    //  {
    btnSo.setLabel(displayData[0]);
    btnPendingSo.setLabel(displayData[1]);
    btnOpenTT.setLabel(displayData[2]);
    btnPendingTT.setLabel(displayData[3]);
    btnTop50So.setLabel(displayData[4]);
    btnTop50TT.setLabel(displayData[5]);
    //  }
       
    Officials in the field initialization
    Managers in the field to add to the Panel
    Add (_fieldManagerBottom1);
    Add (new SeparatorField());
    Add (_fieldManagerBottom2);
    Add (new SeparatorField());
    Add (_fieldManagerBottom3);
    Add (new SeparatorField());
    Add (_fieldManagerBottom4);
    Add (new SeparatorField());
    Add (_fieldManagerBottom5);
    Add (new SeparatorField());
    Add (_fieldManagerBottom6);
    Add (new SeparatorField());
    Add (_fieldManagerBottom7);
        
        
    Code to get the date current system / / start
    Calendar c = Calendar.getInstance (TimeZone.getTimeZone ("GMT"));
    c.setTime (new Date (System.currentTimeMillis ())); now
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    String eventDateString;

    Calendar calendar is Calendar.getInstance (TimeZone.getTimeZone ("GMT"));. GMT will be always supported by getTimeZone
    eventDateString = sdf.format (calendar.getTime ());
    System.out.println (eventDateString);

    Calendar calendarLocal = Calendar.GetInstance ();
    eventDateString = sdf.format (calendarLocal.getTime ());
    System.out.println (eventDateString);
        
    Dim strDate = eventDateString.toString ();
    end of the code to get the date current system: convert to string
        
    _fieldManagerTop.Add (new LabelField ("* ZEO BlackBerry Main Menu *"));
    _fieldManagerMiddle.Add (new LabelField ("summary for today:" + strDate));
      
    Adding field etc.
        
    addition of high so of
    _fieldManagerBottom1.Add (new LabelField (lblTop50So));
    _fieldManagerBottom1.Add (new LabelField(""));
    _fieldManagerBottom1.Add (btnTop50So);
        
    addition of the top 50 TT
    _fieldManagerBottom2.Add (new LabelField (lblTop50TT));
    _fieldManagerBottom2.Add (new LabelField(""));
    _fieldManagerBottom2.Add (btnTop50TT);
        
    Add this field
    _fieldManagerBottom3.Add (new LabelField (lblSo));
    _fieldManagerBottom3.Add (new LabelField(""));
    _fieldManagerBottom3.Add (btnSo);
        
        
    Add on hold pending field etc.
    _fieldManagerBottom4.Add (new LabelField (lblPendingSo));
    _fieldManagerBottom4.Add (new LabelField(""));
    _fieldManagerBottom4.Add (btnPendingSo);
        
    Adding open disturbance
    _fieldManagerBottom5.Add (new LabelField (lblOpenTT));
    _fieldManagerBottom5.Add (new LabelField(""));
    _fieldManagerBottom5.Add (btnOpenTT);
        
    Added forward to TT
    _fieldManagerBottom6.Add (new LabelField (lblPendingTT));
    _fieldManagerBottom6.Add (new LabelField(""));
    _fieldManagerBottom6.Add (btnPendingTT);
        
    Adding tabs for visitors and assignments
    LabelField customersTab, AssignTab, spacer1, spacer2;
        
    customersTab = new LabelField ("Customers", LabelField.FOCUSABLE |) LabelField.HIGHLIGHT_SELECT);
    AssignTab = new LabelField ("Assignments", LabelField.FOCUSABLE |) LabelField.HIGHLIGHT_SELECT);
        
    spacer1 = new LabelField ("|", LabelField.NON_FOCUSABLE);
    spacer2 = new LabelField ("|", LabelField.NON_FOCUSABLE);
    _fieldManagerBottom7.Add (customersTab);
    _fieldManagerBottom7.Add (spacer1);
    _fieldManagerBottom7.Add (AssignTab);
    _fieldManagerBottom7.Add (spacer2);
        
    Buttons by listening to events
    btnSo.setChangeListener (listenerSo);
    btnPendingSo.setChangeListener (listenerPendingSo);
    btnOpenTT.setChangeListener (listenerOpenTT);
    btnPendingTT.setChangeListener (listenerPendingTT);
    }

    Listener for requests for new Service order
    FieldChangeListener listenerSo = new FieldChangeListener()
    {
    ' Public Sub fieldChanged (field field, int context)
    {
    Try
    {
    UiApplication.getUiApplication () .pushScreen (new ServiceOrders());
    }
    catch (Exception ex)
    {
    Dialog.Alert (ex. ToString());
    }
    }
    };
      
    Earphone for in-service control applications
    FieldChangeListener listenerPendingSo = new FieldChangeListener()
    {
    ' Public Sub fieldChanged (field field, int context)
    {
    Try
    {
    UiApplication.getUiApplication () .pushScreen (new PendingSo());
    }
    catch (Exception ex)
    {
    Dialog.Alert (ex. ToString());
    }
    }
    };
    Earphone for open trouble
    FieldChangeListener listenerOpenTT = new FieldChangeListener()
    {
    ' Public Sub fieldChanged (field field, int context)
    {
    Try
    {
    UiApplication.getUiApplication () .pushScreen (new OpenTT());
    }
    catch (Exception ex)
    {
    Dialog.Alert (ex. ToString());
    }
    }
    };
      
    Earphone for pending tickets
    FieldChangeListener listenerPendingTT = new FieldChangeListener()
    {
    ' Public Sub fieldChanged (field field, int context)
    {
    Try
    {
    UiApplication.getUiApplication () .pushScreen (new PendingTT());
    }
    catch (Exception ex)
    {
    Dialog.Alert (ex. ToString());
    }
    }
    };
      
      
    EXIT button that's will close the application...
    FieldChangeListener listenerExit = new FieldChangeListener()
    // {
    ' Public Sub fieldChanged (field field, int context)
    //  {
        
    Dialog.Alert ("thank you for using ZEO BlackBerry");
    System.Exit (0);
    //  }

    //  };
    }

    Rgds

    Nadir

    I solved it sorry for the post... It was just a stupid mistake... rgds Nadir

  • Average read get-stat - virtualdisk.read.average stat?

    Hi all

    I want to use the metric virtualdisk.read.average to calculate the average read speeds per virtual disk to a virtual computer in the last 24 hours (using the 5 min interval)

    [1]

    I want to calculate the average in * every * instance and then add these individual averages until you get the desired amount.

    For example (using real-time output just for example only, I want 24 hours actually):

    MetricId unit Insta timestamp value
    NCE
    --------                ---------                          ----- ----     -----
    VirtualDisk.Read.Ave... 13/05/2011 19:39 6 Kbps scsi0:0
    VirtualDisk.Read.Ave... 13/05/2011 19:38:40 Kbps 11 scsi0:0
    VirtualDisk.Read.Ave... 13/05/2011 19:38:20 KBps 39 scsi0:0
    VirtualDisk.Read.Ave... 13/05/2011 19:38 431 Kbps scsi0:0
    VirtualDisk.Read.Ave... 13/05/2011 19:39 10 Kbps scsi0:1
    VirtualDisk.Read.Ave... 13/05/2011 19:38:40 Kbps 0 scsi0:1
    VirtualDisk.Read.Ave... 13/05/2011 19:38:20 5 kbps scsi0:1
    VirtualDisk.Read.Ave... 13/05/2011 19:38 0 Kbps scsi0:1

    Average (6 + 11 + 39 + 431) = 121.75

    average (10 + 0 + 5 + 0) = 3.75

    Total liked: 121.75 + 3.75 = 125,5

    What is the best way to achieve this? (Unfortunately there is no global instance as with the network and cpu.usagemhz parameters)

    [2]

    For the calculation of the IOPS / s, if you use the metric datastore.*, OR as the virtualdisk.*, is the following statement, 100% good:

    (a) virtualDisk.number [Read |] Write] Averaged.Average will calculate the OPS are / s generated by the virtual machine

    (b) disk.number [Read |] Write] .summation will calculate the OPS are / s that hit this particular data store (useful to see how busy is a data store - but will not provide any info on a single virtual machine (unless by chance, there is only a virtual computer on this data store special))

    [3]

    How to use virtualDisk.number [Read |] Write] calculate the IOPS / s for a given virtual machine?  Depending on the issue [1], to each VMDK, PAHO are / s on average individually and then add the averages for overall IOPS generated by this virtual machine in the last 24 hours?

    Concerning

    marc0

    Kind regards

    marc0

    [1] use the Group-Object and Measure-Object cmdlets for this.

    For example

    $vm = Get-VM MyVM $report = @()
    $stats = Get-Stat -Entity $vm -Stat virtualdisk.read.average -Start (Get-Date).AddHours(-12)
    $stats | Group-Object -Property Instance | %{
        $row = "" | Select Instance,Average
        $row.Instance = $_.Group[0].Instance
        $row.Average = ($stats | Measure-Object -Property Value -Average).Average
        $report += $row}
    $report $total = ($report | Measure-Object -Property Average -Sum).Sum
    Write-Host $vm.Name $total
    

    This will calculate the averages per virtual disk and add the averages together

    [2] see my post get PAHO are / s maximum .

    (a) Yes, provided that you add the OPS are / s for each virtual disk total

    (b) No, if you run the Get-Stat for an entity that is a virtual machine, you will get the statistics for this specific VM disk.

    The metric is available for HostSystem and VirtualMachine. See the column of the entity in the drive settings page.

    [3] Yes

  • Please help - need Urgent read MCC.

    First of all Hello.

    I developing a dialer application for the telecommunications company, that I work for, to easilly allow our users to call through our network (we sell cards call and the phone through a number of carrier selection which must be dialled before the destination). The problem is that I am in need to read the MCC code from the telephone network, the user is saved so that I can detect if the topic is on homelessness, and what country the user is currently in order to call the correct number to reach our switch and router properly, but also to load correctly.

    I tried to use getNetworkOperator() of TelephonyManager, but it returns an empty string. I also tried other methods to get the country (all TelephonyManager), nothing works.

    If anyone can help, I would be VERY grateful.

    Kind regards

    SK

    Hello

    Welcome to the forum!

    At the moment I can not test, but on Android devices, there is another method for the mcc and mnc news.

    Of your business, you can try the following calls:

    getResources () .getConfiguration () .mcc

    getResources () .getConfiguration () .mnc

  • Box state to read option after another event of the listener

    I know that it is something very simple, but I'm still a little fuzzy on the scope of the fields & methods.  I want to read the State of a radio button after another event to the listener.  I did a work around, but I don't know that there is a much better way.

    Code:

    / public final class SelectionScreen extends screen
    {
    public boolean selected;
     
    public SelectionScreen()
    {
    Initialize and configure the title bar
    Super (MainScreen.VERTICAL_SCROLL |) MainScreen.VERTICAL_SCROLLBAR);
    setTitle ("choice screen");
                
    create and add radio buttons for the selection of the screen
    RadioButtonGroup screenGroup = new RadioButtonGroup();
    RadioButtonField screen1Field is new RadioButtonField (Goto screen '1', screenGroup, true, RadioButtonField.FIELD_RIGHT);.
    RadioButtonField screen2Field = new RadioButtonField ("Gogo screen 2", screenGroup, false, RadioButtonField.FIELD_RIGHT);
    Add (screen1Field);
    Add (screen2Field);
        
    I would like to remove this code...
    selected = screen1Field.isSelected ();
        
    screen1Field.setChangeListener (new FieldChangeListener() {}
    {} public fieldChanged no (field arg0, int arg1)
    selected =! selected;
    }
    } );
    down here and use the isSelected inside the button1Press() method
               
    ButtonField buttonField_1 = new ButtonField ('Next', ButtonField.CONSUME_CLICK |) ButtonField.FIELD_HCENTER);
    Add (buttonField_1);
                      
    buttonField_1.setChangeListener (new FieldChangeListener() {}
    {} public fieldChanged no (field arg0, int arg1)
    button1Press();
    }
    } );
    }
      
    private void button1Press() {}
    I would use the next line here
    If {(screen1Field.isSelected ())}
    If {(selected)
    Dialog.Alert ("goes to screen 1");
    } else {}
    Dialog.Alert ("goes to screen 2");
    }
    }
    }

    Just make your RadioButtonFields of the private members of your class so that you can access them from anywhere within the class. That is to say:

    private RadioButtonField screen1Field;

    public SelectionScreen()
    {
    Initialize and configure the title bar
    Super (MainScreen.VERTICAL_SCROLL |) MainScreen.VERTICAL_SCROLLBAR);
    setTitle ("choice screen");
                
    create and add radio buttons for the selection of the screen
    RadioButtonGroup screenGroup = new RadioButtonGroup();
      screen1Field is new RadioButtonField (Goto screen '1', screenGroup, true, RadioButtonField.FIELD_RIGHT);.

    .........

  • How can prevent deletion of the State 'no read' Thunderbird message if it is moved to another folder?

    The installed version of Thunderbird is 31.6.0.
    I have many files in my IMAP account to organize my emails.

    Since one of future versions of Thunderbird emails displaced lose their flag "unread".
    (Sorry - I can't tell since what version exactly this is the case)

    Since I was a tree view of all folders with unread emails (the legend is "Ungelesene Ordner" in my localized installation) for my daily use, it would be very useful to keep the character "unread" in inappropriate emails.

    In my view, there is another aspect of user experience:
    If I move, I won't mark it read.

    My fault. I'm sorry.

    I have receptive use a plugin called "fast Nachrichtenverschieben".

    I missed, that he has the ability to mark a message as read, if you move the message. This option seems to be the 'true' value after an update of this plugin.

    So - this problem is solved.

  • Illegal Argument exception in Swing

    I wrote a Swing program. When I start it there is an Argument exception non-compliant with the message "comparison method violates the general contract.

    But the battery of my code is in there - it's entirely about the AWT event queue (see copy of stack below). And there is no comparison at all in my program.

    The program seems to run OK, but it's more than a little disconcerting. Everyone here you have any ideas what's wrong inside Swing?

    Thanks in advance,

    Peter

    Output of stack is:

    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: comparison method violates the general contract!
    at java.util.TimSort.mergeLo(TimSort.java:747)
    at java.util.TimSort.mergeAt(TimSort.java:483)
    at java.util.TimSort.mergeCollapse(TimSort.java:410)
    at java.util.TimSort.sort(TimSort.java:214)
    at java.util.TimSort.sort(TimSort.java:173)
    at java.util.Arrays.sort(Arrays.java:659)
    at java.util.Collections.sort(Collections.java:217)
    at javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTraversalPolicy.java:136)
    at javax.swing.SortingFocusTraversalPolicy.getFocusTraversalCycle(SortingFocusTraversalPolicy.java:110)
    at javax.swing.SortingFocusTraversalPolicy.getFirstComponent(SortingFocusTraversalPolicy.java:435)
    at javax.swing.LayoutFocusTraversalPolicy.getFirstComponent(LayoutFocusTraversalPolicy.java:166)
    at javax.swing.SortingFocusTraversalPolicy.getDefaultComponent(SortingFocusTraversalPolicy.java:515)
    at java.awt.FocusTraversalPolicy.getInitialComponent(FocusTraversalPolicy.java:169)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:380)
    at java.awt.Component.dispatchEventImpl(Component.java:4731)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
    at $200 (EventQueue.java:103) java.awt.EventQueue.access
    in java.awt.EventQueue$ 3.run(EventQueue.java:682)
    in java.awt.EventQueue$ 3.run(EventQueue.java:680)
    at java.security.AccessController.doPrivileged (Native Method)
    in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:76)
    in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:87)
    in java.awt.EventQueue$ 4.run(EventQueue.java:696)
    in java.awt.EventQueue$ 4.run(EventQueue.java:694)
    at java.security.AccessController.doPrivileged (Native Method)
    in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
    at java.awt.SequencedEvent.dispatch(SequencedEvent.java:116)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
    at $200 (EventQueue.java:103) java.awt.EventQueue.access
    in java.awt.EventQueue$ 3.run(EventQueue.java:682)
    in java.awt.EventQueue$ 3.run(EventQueue.java:680)
    at java.security.AccessController.doPrivileged (Native Method)
    in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:76)
    in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:87)
    in java.awt.EventQueue$ 4.run(EventQueue.java:696)
    in java.awt.EventQueue$ 4.run(EventQueue.java:694)
    at java.security.AccessController.doPrivileged (Native Method)
    in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

    ptoye wrote:
    Yes, but what is the syntax of the string of the property? I tried to 'true', 'TRUE', 'Boolean.true', 'Boolean.TRUE', 'optional boolean. REAL"and other combinations of upper and lower case. And the sun.security.action package is not in the published Javadoc is not easy to know what he wants.

    The value correct woud be 'true', such as recommended by doremifasollatido. But given that the property is accessed from a static context, it must be paid before the class of berries is responsible.

    I guess you can try to set in a static initializer in your class that has a method hand (...) and see if it takes. If not, you're left with the line of command as the only option argument.

    DB

  • Browser in OS 6 Simulator

    Hey I know this OS is fairly new but I already hit a bit of a problem.

    When the app I'm working to try to launch a browser on the Simulator, I get an illegal state Exception. I thought it was just my application until I tried to launch the browser on its own and got the same result. Is there a way to get a web browser working on the Simulator?

    I was actually able to solve the problem. My fixed can be found here:

    http://StackOverflow.com/questions/3639649/BlackBerry-9800-Simulator-crashing-when-launching-browser

  • EditField + BitmapField in a horizontalfield Manager

    Hello

    I use code below to show a field of editing and Bitmap in a horizontal field Manager, but I'm getting illegal state exception...

    If I first add BitmapField and then change the field it works fine but I need Editifield first and then BitmapField

    Below is my code...

      Bitmap bg = Bitmap.getBitmapResource("twenty.png");
      locations = new BitmapField(bg,bg,"Locations");
      EditField table=new EditField("Ticket No : ","",5,EditField.FILTER_NUMERIC)
             {
                    private int iRectX = getFont().getAdvance(getLabel());
                    private int iRectWidth = Display.getWidth() - iRectX - 4;
                    public void paint(Graphics g)
                     {
                                g.setColor(0x000000);
                                g.drawRect(iRectX, 0, 170, 18);
                                super.paint(g);
                    }
             };
    
      HorizontalFieldManager hfm=new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH);
      hfm.add(locations);
      hfm.add(table);
      add(hfm);
    

    I already tried taking two horizontal field to add the edit field in the image in another Manager and added these two leaders in vertical field but no luck...

    I also tried traced table...

    EditFields use the full available width.
    You can crush getPreferredWidth or use a custom presentation:
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800508/...

Maybe you are looking for