Paint screen on fieldchangelistener

Hi all

I'm having a little hold with a question. I would like to paint a new image based on the selection made by the user to the screen (selection is made by an ObjectChoiceField). I'm sure that this is possible, I don't know what code to use. Could someone please help on this issue.

Thanks in advance.

Configure your FieldChangeListener on your ObjectChoiceField.

FieldChanged, call your code to paint your image on the screen and then invalidate. It all depends on how you paint this picture on the screen.

Tags: BlackBerry Developers

Similar Questions

  • PaintBackgound of screen does not paint my bitmap image, but don't paint screen?

    There is something I don't understand with the paint and screen paintBackground.

    I am trying to add a background (Bitmap) image to my final class that extends screen and add a VerticalFieldManager on top of the background image.

    Screen.Paint painted my Bitmap, but hides the VerticalFieldManager:

    protected void paint(Graphics graphics) {
      graphics.clear();
      graphics.drawBitmap(0, 0, deviceWidth, deviceHeight, bgBitmap, 0, 0);
      super.paint(graphics);
    }
    

    However, Screen.paintBackground does not paint my Bitmap or my VerticalFieldManager, and I have a blank white screen?

    protected void paintBackground(Graphics graphics) {
      graphics.clear();
      graphics.drawBitmap(0, 0, deviceWidth, deviceHeight, bgBitmap, 0, 0);
      super.paintBackground(graphics);
    }
    

    The API of the playback screen, I thought paintBackground was the right way to achieve this?

    It's an old bug in BB - do not trust Screen.paintBackground (especially MainScreen.paintBackground!). PaintBackground of your Manager is a much better place for it (I know it is not documented, but if you read the Screen.paintBackground you will see it's substitute Field.paintBackground.).

  • How to display the vertical scroll bar in custom painted screen?


    a simple and intelligent search forum and I solved the problem.

    Screen does not scroll without an active field before and after the Manager of the vertical.

    I just addedd a NullField before the Manager and everything works fine!

    Thank you

  • Paint screen

    I use the constructor for screen drawing several bitmaps on a graph and then by loading these have a bitmapfield and finally add to the screen using add (BitmapField).

    Now, I want to be able to change the bitmap image that I drew on the graph and repaint the screen.  I thought repaint the screen, but I don't know if it will work due to being of graph in memory and me do not update the chart wouldn't change anything.

    How can I implement this to allow me to change the bitmaps on graphics and the screen draw all over again?

    Is it possible to replace the function object of the screen or the chart itself, maybe BitmapField for I can get the desired results?

    Thank you

    OK, I'm confused. If you add a BitmpaField to your form, and then create a second Bitmapfield, how he added to the screen.

    The correct sequence:

    BitmapField m_bitmapFld = BitmapField (image) new

    Add (m_bitmapFld)

    .. now, the user clicks on something in order to change the bitmap:

    m_bitmapFld.SetImage (b)

    Invalidate()

    ... today, the screen is repainted with your new image.

  • How can I paint screen manually on another screen?


    I understand that there is no way to achieve my idea, is there?

  • CheckboxField [] and fieldChangeListener.

    Hello

    I need a dynamic number of checkboxes for a project I'm working on. My code example is as follows. Somehow, I get an jvm stackoverflow exception.

    public class abc() extends screen implements {FieldChangeListener}

    CheckboxField [] boxField;

    public abc() {}

    .

    .

    .

    the length is variable.

    boxField = new CheckboxField [length];

    VFM VerticalFieldManager = new VerticalFieldManager();

    for (int i = 0; i)

    boxField [i] = new CheckboxField();

    boxField [i] .setChangeListener (this);

    VFM. Add (boxField [i]);

    }

    Add (VFM);

    }

    Sub fieldChanged (field field, int context) {}

    Hardcode for now. The intention is to loop through and uncheck all

    except one who was just ticked.

    chkBoxField [0] .setChecked (false); StackOverflow exception

    }

    }

    Help?

    In this way:

    chkBoxField [0] .setChecked (false);

    You set the value of the checkbox, prompting to advise its FieldChangeListener, which is to set the value of the box, which advises the FieldChangeListener... I could go on.   Until what I stack overflowed of course.

    Although there are many ways to stop this, I think that you should be aware of using the context provided to the fieldChanged method.  To check

    FieldChangeListener.PROGRAMMATIC

    If it matches, then the change was made by a program and not by the user, in which case you should ignore the change.

    For example:

    Sub fieldChanged (field field, int context) {}

    If (context == FieldChangeListener.PROGRAMMATIC) {}

    Only to process user changes to checkboxes

    return;

    }

    .....

    Hope it makes sense.

    Edit: this has been creating during the validation of RexDoug, my apologies for the repetition.

  • Error IllegalStateException when the construction of a screen

    1. the version of BlackBerry device software and BlackBerry model test you it with (or simulate). You can find this information under Options.
    > OS 4.5.x / Curve 8330 using the Smartphone Blackberry 2.9.0.52 Simulator

    2. the version of BlackBerry JDE or BlackBerry JDE component Package used to build the application.
    > Eclipse 3.5.1 version identifier: 20090920-1017; BlackBerry Java plug-in Version: 1.1.1.200911111641 - 15; BlackBerry Java SDK version 4.5.0.21

    3. the exact error, an exception or a behavior that you are experiencing. Try to avoid statements like "it doesn't work".

    > Thread stack:

    Thread [CarMinderBB (122) id = 1149878272] (Suspended (exception IllegalStateException))
    AddCarScreen (Field) .assertLayoutComplete () line: 717
    Screen$ ScreenFieldVisitor.Visit (field, int) line: 5118
    AddCarScreen (Manager) .acceptVisitor (FieldVisitor) line: 400
    AddCarScreen (Screen) .assertLayoutCompleteOnScreen () line: 402
    AddCarScreen (Screen) .doLayout () line: 958
    UiEngineImpl.pushScreen (Screen) line: 671
    CarMinder (UiApplication) .pushScreen (Screen) line: 291
    CarMinder. (line): 54
    CarMinder.main (String []) online: 82

    4. If possible, the line of code that triggers the error or exception, as well as an excerpt from the preceding code.

    If {(cars.isEmpty ())}
    pushScreen (new AddCarScreen (true));  CarMinder.java online: 291
    } else {}
    pushScreen (new CarMinderScreen());
    }

    ****************

    public class addcarscreen extends screen implements {FieldChangeListener}

    public AddCarScreen (Boolean test) {}
    LabelField newscreen is new LabelField ("Simple tags");.
    Add (newscreen);
    }

    }

    As you can see, I do not have a complicated code path, but I am unable to discern why that IllegalStateException is thrown.  Of research forums, the possibility of adding to the Manager after pushing the screen has been raised, but it seems that the error here is thrown before the AddCarScreen object is fully built, so I don't think it's on the stack of the screen (but I could be wrong!).

    Given that most of the stack trace involved code of the RIM, I don't have access to determine what she wants.  Any help would be most appreciated.

    I always get java and c ++, but "this" passing of a ctor can create confusing results.

    You do not have the source code, but you can scroll through this kind of thing and look at the fields. Things 'assert '.

    are several checks and the name, looks like he's complaining about the State of the page layout.

    You outweighs dolayout?

    I remember if you go through you will find (many LOL) "asseertEventThread" or something similar with

    the name being called on some operating systems.

  • Loading screen does not change the Image

    I have a problem with the field of gif. What I'm trying to do, is show a progress screen that the problem is its not like an animation. Its as if she makes just the first frame of the gif image.

    I have load call that changes the image that some real treatment goes.

    I thnk its happens because of the event put on another thread. but I can't understand that out can you please help me? Here is my code can you please help where I encounter an error.

    DataStore.answeringThread = new AnsweringThread();
    DataStore.answeringThread.start ();

    final LoaderScreen ls = new LoaderScreen();
    ls.setShowLoader (true);
    Status.Show ("Please wait...", 10);
    UiApplication.getUiApplication () .pushScreen (ls);

    /*---*/UiApplication.getUiApplication () .invokeLater (new Runnable()
    {
    public void run()
    {
    try {}
    DataStore.answeringThread.join ();
    } catch (System.Exception e)
    {}
    UiApplication.getUiApplication () .popScreen (UiApplication.getUiApplication () .getActiveScreen ());
    UiApplication.getUiApplication () .pushScreen (new Answering());
    }
    });/*--------*/

    I am able to see screeen of loading for the first time, only to change its image as time passes but it isn't happeing instead, it makes only first image. and then the new response screen appears.

    If I comment the code between two - and - image changes as appropriate.

    Your problem is that you use a blocking operation and the Blackberry is never really painted screen.

    There are 2 possible solutions:

    (1) the blocking operation thread. This means that spawn a real thread to use UIApplication.invokeLater () instead.

    (2) paint before calling your blocking with the force operation: Ui.getUiEngine () .repaint (); It means the battery display to repaint and your screen will be permanently shown.

  • Run the error!

    Hi all.

    I have this code, everything works fine, after I clicked on btnSend an email is sent to the e-mail address specified, a runtime error is thrown? no help... This is the code...

    class Lesson2Screen extends screen implements {FieldChangeListener}
    ButtonField btnSubmit = new ButtonField ("Accept");
      
     
     
    ' Public Sub fieldChanged (field field, int context)
    {
    if(Field == btnSubmit) {}
    Invoke.invokeApplication (Invoke.APP_TYPE_MESSAGES, new MessageArguments (MessageArguments.ARG_NEW, eTo.getText () + "Accept", eSubject.getText (), eBody.getText ()));
    }
    if(Field == btnSend) {}
    sendMail (eTo.getText (), eSubject.getText () +"reject", eBody.getText ());
              
    }
    }
      
    ButtonField btnSend = new ButtonField ("Reject");
       
    MyMenu MenuItem = new MenuItem ("my Menu!", 1, 100) {}
    public void run() {}
    Dialog.Alert ("you clicked on my Menu!");
    }
    };
       
       
    LabelField topLabel = new LabelField ("' * confirm or deny the *", LabelField.FIELD_HCENTER ") {}
    {} public void paint (Graphics graphics)
    graphics.setColor (0x00AA0099);
    Super.Paint (Graphics);
    }
    };
       
    EditField eTo = new EditField ("to: j.f","@cmo.com");
    EditField eSubject = new EditField ("object:", "I");
    EditField eBody = new EditField("Body:","");
       
    public Lesson2Screen() {}
    Super();
    LabelField title = new LabelField ("Create E-mail messages-everSuit");
           
    setTitle (title);
           
    Add (topLabel);        Add (new SeparatorField());
           
    Add (ETO);
    Add (eSubject);
    Add (eBody);
    Add (new SeparatorField());
           
    addMenuItem (myMenu);
    Add (btnSubmit);
    Add (btnSend);
    btnSubmit.setChangeListener (this);
    btnSend.setChangeListener (this);
    }
      
    ' Public Sub sendMail (String, String object, String body) {}
    try {}
                       
    Store is Session.getDefaultInstance () .getStore ();.
    Records file [] = store.list (Folder.SENT);
    Folder sentfolder = files [0];
                       
    Message msg = new Message (sentfolder);
                       
    ToList [] address = new address [1];
    toList [0] = new Address (to, to);
    msg.addRecipients (Message.RecipientType.TO, toList);
                       
                     
    msg.setSubject (subject);
    msg.setContent (body);
    Transport.Send (MSG);
    } catch (Exception e) {}
                         
    }
    }
           
    public boolean onClose() {}
           
    System.Exit (0);
    Returns true;
    }
    }

    Thanks man for interested... my problem is now solved with debuger

  • Performance TextFilter problem...

    Hi, I use textFielter in my CustomEditField in my Page of my connection request. TextFilter.Interger works fine but the problem is that it slows down the speed of typing in my editField... I also write my codes for my customTextFilter, login and CustomEdit Field... Kindly give me solution and suggestions for that...

    ----------------------------------------------LoginPage---------------------------------------------------------

    package mypackage;

    import java.util.Date;

    Import net.rim.device.api.lowmemory.LowMemoryListener;
    Import net.rim.device.api.lowmemory.LowMemoryManager;
    Import net.rim.device.api.system.Display;
    Import net.rim.device.api.ui.DrawStyle;
    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.Manager;
    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.device.api.ui.component.Dialog;
    Import net.rim.device.api.ui.component.EditField;
    Import net.rim.device.api.ui.container.MainScreen;
    Import net.rim.device.api.ui.container.VerticalFieldManager;
    Import net.rim.device.api.ui.text.TextFilter;

    /**
    * A class that extends the class screen, which offers default standard
    * behavior for BlackBerry GUI applications.
    */
    public class AgAppLoginPage extends screen implements FieldChangeListener / /, LowMemoryListener
    {

    Private CustomEditField txtMobileNumber;
    Private EditField editField.
    Private CustomPasswordEditField txtPinNumber;
    Private CustomButtonField btnLogin;
    private static String stxtMobileNumber;
    private static String stxtPinNumber;

    public AgAppLoginPage()
    {

    VerticalFieldManager vertMgr = VerticalFieldManager(Manager.VERTICAL_SCROLL | nouveau Manager.VERTICAL_SCROLLBAR |) USE_ALL_WIDTH | USE_ALL_HEIGHT)
    {
    protected void sublayout (int maxWidth, maxHeight int)
    {

    Super.sublayout (Display.getWidth (), Display.getHeight ());
    setExtent (Display.getWidth (), Display.getHeight ());

    }

    };

    LockedHeaderHorizontalManager HorMgr = new LockedHeaderHorizontalManager("LoginPage");

    vertMgr.add (HorMgr);

    CustomLabelField lblTop = new CustomLabelField ("Sign In", Font.getDefault () .getHeight () + 10, Field.FIELD_HCENTER |) DrawStyle.LEFT);
    txtMobileNumber = new CustomEditField ("Mobile number");
    txtPinNumber = new CustomPasswordEditField ("PIN");
    editField = new EditField("MyTextFilterEditField","");
    btnLogin = new CustomButtonField ("Log In", "Wide", "login.png");

    lblTop.setMargin (5,0,0,0);
    vertMgr.add (lblTop);

    txtMobileNumber.setMargin (5,0,0,0);
    vertMgr.add (txtMobileNumber);

    txtPinNumber.setMargin (5,0,0,0);
    vertMgr.add (txtPinNumber);

    vertMgr.add (editField);
    btnLogin.setMargin (5,0,0,0);
    btnLogin.setChangeListener (this);
    vertMgr.add (btnLogin);
    Add (vertMgr);
    This.Add
    }

    public void close()
    {
    If (Dialog.ask (4, "Do you really want to leave MCB-Lite") == Dialog.OK)
    System.Exit (0);
    }

    ' Public Sub fieldChanged (field field, int context)
    {
    if(Field == btnLogin)
    {
    If (txtMobileNumber.getTextLength () == 0 | txtPinNumber.getTextLength () == 0)
    {
    Dialog.Alert ("Please enter all info!");
    }
    on the other
    {
    stxtMobileNumber = txtMobileNumber.getText ();
    txtMobileNumber.setFilter (MyTextFilter.get (TextFilter.NUMERIC));
    editField.setFilter (MyTextFilter.get (TextFilter.NUMERIC));
    stxtPinNumber = txtPinNumber.getText ();
    getResponse processRequestAndWait = new processRequestAndWait();
    AgAppPleaseWaitScreen.showScreenAndWait (getResponse);
    txtPinNumber = null;

    }
    }

    }

    static class processRequestAndWait implements Runnable
    {

    public void run()
    {
    final String [] [] xmlResponse.

    If (AgAppHelperMethods.agAppConnection.CompareTo ("SMS")! = 0)
    {
    xmlResponse = AgAppHelperMethods.AgAppXMLParser ("AG_IT_App/AgMainServlet? messageType = LOG & pine = "+ AgAppHelperMethods.getPIN (stxtPinNumber) +" & mobile = "+ stxtMobileNumber +"& source ="+ stxtMobileNumber +" & channel = INTERNET; deviceside = true");
    = AgAppHelperMethods.AgAppXMLResponse xmlResponse (XMLResponse.login ());
    }
    on the other
    {
    AgAppHelperMethods.msg = "AGLOG" + stxtMobileNumber + stxtMobileNumber + AgAppHelperMethods.getPIN (stxtPinNumber); ".
    xmlResponse = AgAppHelperMethods.AgAppSMSParser ();
    }

    UiApplication.getUiApplication () .invokeLater (new Runnable()
    {
    public void run()
    {
    if(xmlResponse[0][0].) CompareTo ("null") == 0)
    {
    UiApplication.getUiApplication () .pushScreen (new AgAppResponseScreen ("Login screen", "host not Responding", Font.getDefault () .getHeight ()));
    }
    if(xmlResponse[1][1].) CompareTo("00") == 0)
    {
    TimeCalculator.timeStart = new Date();
    TimeCalculator.timeEnd = new Date();

    AgAppHelperMethods.varName = xmlResponse [3] [1];
    AgAppHelperMethods.varBalance = xmlResponse [4] [1];
    AgAppHelperMethods.varMobileNo = stxtMobileNumber;
    UiApplication.getUiApplication () .pushScreen (new AgAppHomePage());

    }
    on the other
    {
    UiApplication.getUiApplication () .pushScreen (new AgAppResponseScreen ("Login Screen", AgAppHelperMethods.getStatus(xmlResponse[1][1]), Font.getDefault () .getHeight ()));
    }
    }
    });
    }

    }

    }

    ----------------------------------------------------CustomEditField----------------------------------------------------------

    package mypackage;

    Import net.rim.device.api.ui.Color;
    Import net.rim.device.api.ui.Font;
    Import net.rim.device.api.ui.Graphics;
    Import net.rim.device.api.ui.XYEdges;
    Import net.rim.device.api.ui.component.EditField;
    Import net.rim.device.api.ui.decor.BackgroundFactory;
    Import net.rim.device.api.ui.decor.Border;
    Import net.rim.device.api.ui.decor.BorderFactory;
    Import net.rim.device.api.ui.text.TextFilter;

    class CustomEditField extends EditField
    {
    Private boolean _focusableFlag;
    private String defaultText;

    public CustomEditField (String defaultText)
    {
    Super (FIELD_HCENTER);
    this.defaultText = defaultText;

    }

    {} public void setFocusable (boolean focusable)
    _focusableFlag = active;
    }

    protected void layout (int width, int height)
    {
    Width = Font.getDefault () .derive (Font.BOLD, Font.getDefault () .getHeight () - 2) .getAdvance ("transfer of my linked account") + 40.
    height = Font.getDefault () .getHeight ();
    Super.Layout (Width, Height);
    super.setExtent (width, height);
    super.setFilter (MyTextFilter.get (TextFilter.NUMERIC));

    }

    protected void paint (Graphics g)
    {
    setBorder (BorderFactory.createRoundedBorder (new XYEdges (5,5,5,5), 0xD0D0D0, Border.STYLE_SOLID));
    setBackground (BackgroundFactory.createSolidBackground (Color.WHITE));

    If (Super.GetText () .length () == 0)
    {
    g.setColor (0xD0D0D0);
    g.drawText (defaultText, 0, 0);
    }

    g.setColor (0x484C54);
    Super.Paint (g);

    }

    }

    ----------------------------------------------------------MyTextFilter---------------------------------------------------

    package mypackage;

    Import net.rim.device.api.ui.text.TextFilter;
    Import net.rim.device.api.util.CharacterUtilities;

    SerializableAttribute public class MyTextFilter extends TextFilter {}

    public char convert (character char, int status) {}
    TODO self-generating method stub
    If (! validate (character))
    {
    return 0;
    }
    Returns the character;
    }

    public boolean validate (char character) {}
    TODO self-generating method stub

    If (CharacterUtilities.isDigit (character))
    Returns true;
    ElseIf (CharacterUtilities.isLetter (character))
    {
    If ((caractère == serait ') |) (caractère == serait '))
    {
    Returns true;
    }
    }
    Returns false;
    }
    }

    It's a little hard to dig through the wall of the code, please use code tags next time.

    I don't think that the textfilter slows your app, I think that you run on the user interface thread things that belong here.
    Move to a thread blocking operations separate, you can use a callback model, for example.
    See
    http://supportforums.BlackBerry.com/T5/Java-development/what-is-the-event-thread/Ta-p/446865

  • Change on the fly application background image

    My main application screen has a background image, set (it is abbreviated):

    Class BBScreen extends screen implements {FieldChangeListener}

    public BBScreen()

    {

    Super (Manager.NO_VERTICAL_SCROLL);

    setTitle ("my app");

    BM1 = Bitmap.getBitmapResource (...);

    vfm0 = new VerticalFieldManager (...) {

    public void paint (Graphics graphics)

    {

    graphics.drawBitmap (..., bm1,...);

    Super.paint (graphics);

    }

    };

    Add (vfm0);

    }

    }

    However at some point during execution, I want the background image of the bm1 to bm2.  How to set the new picture and that the painting occurs?  Thanks for the pointers.  FD

    Try something like this:

    public class BBScreen extends MainScreen implements FieldChangeListener{    Bitmap bm1 = Bitmap.getBitmapResource("image1.png");    Bitmap bm2 = Bitmap.getBitmapResource("image2.png");    Bitmap mainBitmap;    public TestScreen()     {        super(Manager.NO_VERTICAL_SCROLL);        setTitle( "My Title");           mainBitmap = bm1;        VerticalFieldManager vfm0 = new VerticalFieldManager(...)        {            public void paint(Graphics graphics)            {                graphics.drawBitmap(.., mainBitmap, ...);                super.paint(graphics);            }         };        ButtonField btn = new ButtonField("Change Background");        btn.setChangeListener(this);        vfm0.add(btn);        add(vfm0);        }    public void fieldChanged(Field field, int context)     {        mainBitmap = bm2;       this.invalidate();   }}
    

    Concerning

    Bika

  • Add OS 7.0 VGField under another problem of fields

    Hello!

    I have very bad problem in OS 7.0.

    My layouts from VGField under an other fields (e.g. buttons, labels). OS 6.0, torch, painted screen properly, like I need - VGField makes the scene under fields.

    But in OS 7.0, it is little matter in what order VGField add in Manager, he always makes VGField on top, and another field are not visible.

    Here are the pictures that are explain my problem more clear:

    1st picture, OS 6.0, torch, correct. VGField under buttonField and rectangle painted

    9900 photo device, OS 7.0, 2nd. The same source, but not all fields and graphics on VGField

    I solved the problem.

    CanvasComponent - Manager where I put fields except VGField, in OS 7.0 this Manager is always drawn on top.

  • I'm illegalStateException

    I try to extract the contents of an xml using the code below but it opens the screen at first, then gets a wen illegalstateException that he tries to get the XML

    Please advice

    package main45;

    Import artistapp.main.TextBitmapManager;

    import java.io.IOException;
    import java.io.InputStream;
    Import javax.microedition.io.Connector;
    Import javax.microedition.io.HttpConnection;
    Import javax.microedition.xml.rpc.Element;

    to import org.W3C.DOM.document;
    Import org.w3c.dom.Node;
    Import org.w3c.dom.NodeList;
    Import org.xml.sax.SAXException;

    Import net.rim.device.api.system.Bitmap;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.FieldChangeListener;
    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.device.api.ui.component.Dialog;
    Import net.rim.device.api.ui.component.LabelField;
    Import net.rim.device.api.ui.component.RichTextField;
    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.xml.parsers.DocumentBuilder;
    Import net.rim.device.api.xml.parsers.DocumentBuilderFactory;
    Import net.rim.device.api.xml.parsers.ParserConfigurationException;

    public class airmainscreen extends screen implements {FieldChangeListener}

    Private AboutButtonField aboutbutton;
    Private EventsButtonField eventbutton;
    Private VideoButtonField videobutton;
    Private UpdatesButtonField updatesbutton;
     
     
    connection of load
    HttpConnection hc = null;
    Element = null;
    Gross StringBuffer = new StringBuffer();
    String temp;
    String rd;
    Channel file;
    Paper chain;
    String lenx;
    String parentName;
     
    public AirMainScreen() {}
    TODO auto-generated constructor stub
    Bitmap bm = Bitmap.getBitmapResource("images/icons/video.png");
      
    Lf channel = "ally Lilly |" Bio;
    TextBitmapManager hm = new TextBitmapManager (lf, WB);
    setTitle (hm);
      
      
      
    buttons
    HorizontalFieldManager hmanager = new HorizontalFieldManager();
    aboutbutton = new AboutButtonField ("About", 0);
    aboutbutton.setChangeListener (this);
    hmanager. Add (aboutbutton);
      
    videobutton = new VideoButtonField("Video",0);
    videobutton.setChangeListener (this);
    hmanager. Add (videobutton);

    eventbutton = new EventsButtonField("Events",0);
    eventbutton.setChangeListener (this);
    hmanager. Add (eventbutton);
      
    updatesbutton = new UpdatesButtonField("Updates",0);
    updatesbutton.setChangeListener (this);
    hmanager. Add (updatesbutton);
      
      
      
    Add to the center manager
    CenterManager cmanager2 = new CenterManager();
    cmanager2.setbackground (BackgroundFactory.createLinearGradientBackground (0x9966FF, 0x9999CC, 0x9966FF, 0x9999CC));
      
    cmanager2. Add (hmanager);
    Add (cmanager2);
      
    Add (new SeparatorField());
      
    Thread t = new HttpFeed();
    t.Start ();
      
      
    }
     
     
     
    void displayNode (node node, int depth)
    {
    {if(node==null)}
    UiApplication.getUiApplication () .invokeLater (new Runnable() {}

    public void run() {}
    TODO self-generating method stub
    Dialog.Alert ('no');
    }
        
    });

    }
      
      
    If (node.getNodeType () is Node.ELEMENT_NODE)
    {
    StringBuffer buffer = new StringBuffer();
    indentStringBuffer (buffer, depth);
    NodeList childNodes = node.getChildNodes ();
    int numChildren = childNodes.getLength ();
    FirstChild node = childNodes.item (0);
     
    If the node has only one child and that child is a text node, it is
    the form of text, so print '= 'Text' element'.
       
    If (numChildren == 1 & firstChild.getNodeType () == Node.TEXT_NODE)
    {
         
       
    buffer. Append (firstChild.getNodeValue ());
    buffer. Append ("\n");
    Add (new RichListFieldx (buffer.toString (), 0));
    Add (new SeparatorField());
       
    }
    on the other
    {
      
    parentName = node.getNodeName ();
     
    for (int i = 0; i)< numchildren;="" ++i="">
    {
    displayNode (childNodes.item (i), depth + 1);
    }
    }
    }
    on the other
    {
     
    String nodeValue = node.getNodeValue ();
    If (nodeValue.trim () .length ()! = 0)
    {
    StringBuffer buffer = new StringBuffer();
    indentStringBuffer (buffer, depth);
    buffer. Append (' "") .append (nodeValue) .append ("'");
    Add (new RichTextField (buffer.toString ()));
    }
    }
    }

    ' Public Sub fieldChanged (field field, int context) {}
    TODO self-generating method stub
     
      
    }

    class HttpFeed extends Thread {}

    HttpConnection hc = null;
    InputStream is;
    RootElement element;
    Document document = null;
     
    public HttpFeed() {}
    TODO auto-generated constructor stub
    }
     
     
    public void run() {}
    try {}
    HC = (HttpConnection), Connector.open ("path-to-xml");
    hc.setRequestMethod (HttpConnection.GET);
    hc.setRequestProperty ("Content-Type", "plain of //text");
    Final InputStream is = hc.openInputStream ();
    final int len = (int) hc.getLength ();
    mutable int ok = hc.getResponseCode ();
    final String rm = hc.getType ();
      
     
      
    Unwrap the xml
    DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
    DocumentBuilder builder = null;
    try {}
    Builder = factory.newDocumentBuilder ();
    } catch (ParserConfigurationException e) {}
    Generative TODO catch block
    e.printStackTrace ();
    }
    HC = (HttpConnection) Connector.open (url + "; deviceside = true");
    hc.setRequestMethod (HttpConnection.GET);
    InputStream inputStream = hc.openInputStream ();
    file = hc.getFile ();
    try {}
    Document document = builder.parse (is);
    LenX = document. GetElementsByTagName ("to"). Item (0) .getChildNodes (). Item (0) .getNodeValue ();

    org. W3C. DOM. Element rootElement = document.getDocumentElement ();
    rootElement.normalize ();
    Generative TODO catch block
        
            
    displayNode (rootElement, 0);

    } catch (SAXException e) {}
    Generative TODO catch block
    e.printStackTrace ();
    }
    HC. Close();
    is. Close();

    } catch {} (final IOException e1)
    Generative TODO catch block
    UiApplication.getUiApplication () .invokeLater (new Runnable() {}
    public void run()
    {
    Dialog.Inform (E1.getMessage ());
    System.out.Print (E1.getMessage ());
    }

    });
      
    }
     
     
    }
       
     
     
    }

    }

    It is useful to use the Debug lines like the following. :

    try {}

    } catch (Throwable t) {}

    Code that could be a mistake

    t.printStackTrace ().

    System.out.println ("Exception" + t.toString ());

    {

    This will tell you what really is the Exception.

    In this case, I am convinced, that it is because you are trying to update the User Interface of a Thread that is not the thread of events.  It is a common problem, and there are discussions in this forum dealing with this.  I suggest rather than repeat myself this information, looking around.  There is also a video that addresses the event Thread I think, you might find useful.

  • The mIDlet class is not public: ttt

    Hello, Imam getting the error in the subject (ttt is my main class) when I try to install an application on a Blackberry device.

    My class TT is public, here is a sample of my code:

    public class ttt extends UiApplication {}

    public ttt() {pushScreen)

    new HelloScreen());

    }

    public public static void main (String argv {TT app = new ttt();})

    app.enterEventDispatcher ();

    }

    public class HelloScreen extends screen implements {FieldChangeListener}

    private ButtonField button1;

    private ButtonField button2; private ButtonField button3;

    public {HelloScreen()}

    ........

    Any ideas please?

    How do you install the application?

    Check this thread.

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=29938&query.ID=14...

  • Strange button action

    Hi all

    I have a button with an action. But something strange happens with this action to the button. Whenever I click on the button, my action will be performed, but after that the unit will act that I press the button with the logo Blackberry inside (the button that shows "Close Application and Switch"), although I do not give any code to activate this button. Here are some of my code...

    [code]

    public class xmlhidscreen extends screen implements {FieldChangeListener}

    ...

    ...

    [A] I have another button called INFOButton, but that button is not one who has the problem

    Use the styles when you create your ButtonField:

    ButtonField myButton = new ButtonField ("Button text", ButtonField.CONSUME_CLICK |) ButtonField.NEVER_DIRTY);

    is a good practice.

    Good luck!

Maybe you are looking for

  • Palm Desktop 6.2.2: Palm Desktop 6.2.2 with Windows 10

    What is someone having the same problem: I installed Palm Desktop 6.2.2 on my Windows 10 system, sync'd and everything worked fine for about 30 days approximately.  The other day I started my computer, went to Palm Desktop and found all the files (in

  • Microsort Teredo Tunneling Adapter this device cannot start (Code 10)

    Help, please. Previous attempts have failed. Moved from feedback

  • How to use the file transfer Wizard

    I have and old Dell XP and I am go buy new Dell with Windows 7.  I'm going to disconnect the old computer and with some help Setup new computer using Dell Windows 7. I want to save, copy and install My Documents, My computer, email, and Favorites in

  • HP Desktop PC 23-1014 - want to extend the display of page time

    23-1014 HP desktop PC - my time view page for internet viewing isn't that 20 seconds, after that time, it then stops and returns me to the start mode to return my password - to return to the page I was reading. How to extend my page look at a time of

  • Stand-alone installation of Windows 7 problem

    I have just installed Windows 7 Home Premium 64 - Bit and then installed an upgrade to Windows 7 Ultimate on a new desktop computer. All up and running. When I download and try to install Service Pack 1 - KB947821-v34 - x 64, I encounter this error W