RichTextField update

Hello.

I am new to the BlackBerry development so this issue is fundamental. I created a RichTextField called lblSpeed and populated with text from a public class called myScreen.

The application must be able to update the text in lblSpeed at a later date, but I am able to do. How can I access the new field?

Kind regards

Mike

In your constructor, you declare a local variable lblSpeed. This hides the member variable, which is never initialized. That is why the null pointer exception. Just eliminate the "RichTextField" prior to lblSpeed award in the tor.

Tags: BlackBerry Developers

Similar Questions

  • Update the fields in a HorizontalFieldManager

    I have this kind of configuration, basically, I have a refreshment menuitem that once selected will extract data from an xml page. I have already developed information retrieval, my problem is the display of the information. I searched the forums and found methods such as invalidate() or updateLayout(), but it does not work for me. (Well it should, but obviousky I do not know where to place/calling these methods)

    the information is supposed to be displayed using the LetterA1a1RichTextField. Each chef has his own custom handler class.

    Here is my code, it's a bit long.

    Inside of the class that extends screen:

    public void setupScreen(){   this.addMenuItem(new MenuItem("Refresh", 100, 1)   {          public void run()         {                    /***            * fetch information            */              fmi = new FetchMarketIndices(mi);            fmi.start();       updateScreen(fmi.getMarketIndices());                    }    });}public synchronized void updateScreen(MarketIndices mi){    letterAHorizontalFieldManager.updateFields(mi, getScreenComponents());    this.invalidate();}
    

    The class inside LetterAHorizontalFieldManager:

    public synchronized void updateFields(MarketIndices mi, ScreenComponents sc){    letterA1VerticalFieldManager.UpdateFields(mi, sc);    this.updateLayout();}
    

    The class inside LetterA1VerticalFieldManager:

    public void UpdateFields(MarketIndices mi, ScreenComponents sc){  int nColor=Color.WHITE;
    
     if(Double.parseDouble(mi.getAll()) > 0)    {     nColor = Color.LIMEGREEN;     letterA1aHorizontalfieldmanager.SetText("+"+mi.getAll(), sc, nColor); }                 else if(Double.parseDouble(mi.getAll()) < 0)   {     nColor = Color.RED;       letterA1aHorizontalfieldManager.SetText(mi.getAll(), sc, nColor); }
    
       this.invalidate();}
    

    LetterA1aHorizontalfieldManager backwards:

    public void SetText(final String text, final ScreenComponents sc, final int nColor){    deleteRange(1, 1);    letterA1a1RichTextField = new RichTextField(text, RichTextField.NON_FOCUSABLE | RichTextField.TEXT_ALIGN_RIGHT)    {        //override the paint method of RichTextField to allow changing of font color        public void paint(Graphics graphics)         {            setFont(sc.getContentFont());            graphics.setColor(nColor);            super.paint(graphics);
    
            }    };    add(fieldSetValue);    this.updateLayout();}
    

    Help please!

    Solved... apparently the RichTextField is updated, but the field was simply not visible. I forgot to update the width of the textfield object to fit inside the Manager... Thanks anyway.

  • How UnFocus the RichTextField

    In blackberry, I can use the wheel to control the update in the application.

    Recently, I create an application that has a RichTextField. When I use the wheel to control the update, it will define the RichTextField in short. But I want to unplugged the cursor focus in this RichTextField. What is a way to do it?

    I think that this thread is discussing the same question you ask yourself:

    How to make a NON_FOCUSABLE field at run time

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&thread.ID=27304

  • LocationListener does not receive updates when BrowserField 2 renders in 6.0

    I have an application that calls a mobile web site using BrowserField 2.  The application needs make the current GPS position to the mobile website with each request to the site.

    I used code MultipleFixDemo to get a LocationListener job.  Everything worked very well in the Simulator and all manual updates of location were received by the LocationListener in the application.

    I changed the display to include a component BrowserField 2 and the LocationListener does not update the location of the Simulator.

    Y at - it something I need to do something different when the user interface includes the BrowserField.  Can I have some kind of thread problem?  I only tested on OS 6.0 in the Simulator.  I don't have access to a real device.

    In the code below, I have two defined screens.

    If the pushScreen (new MultipleFixScreen() is uncommented and the pushScreen (new BrowserFieldScreen() is commented out, the LocationListener receives updates.)

    If the pushScreen (newMultpleFixScreen () is commented out and the pushScreen (new BrowserFieldScreen() is uncommented, the LocationListener gets no updates.)

    Here is my code:

    public class MultipleFixDemo extends UiApplication
    {
        private double longitude;
        private double latitude;
        BlackBerryLocationProvider myProvider;
    
        public static void main(String[] args)
        {
            new MultipleFixDemo().enterEventDispatcher();
        }
    
        public MultipleFixDemo()
        {
            startLocationUpdate();
    
            pushScreen(new BrowserFieldScreen());
            //pushScreen(new MultipleFixScreen());
        }
    
       private void startLocationUpdate()
        {
            try
            {
                BlackBerryCriteria myCriteria = new BlackBerryCriteria();
                myCriteria.enableGeolocationWithGPS(BlackBerryCriteria.FASTEST_FIX_PREFERRED);
                try
                {
                    myProvider = (BlackBerryLocationProvider)LocationProvider.getInstance(myCriteria);
    
                    if ( myProvider == null )
                    {
                        Runnable showUnsupportedDialog = new Runnable()
                        {
                            public void run() {
                                Dialog.alert("Location service unsupported, exiting...");
                                System.exit( 1 );
                            }
                        };
                        invokeLater( showUnsupportedDialog );
                    }
                    else
                    {
                        myProvider.setLocationListener(new LocationListenerImpl(), 2, -1, -1);
    
                    }
                }
                catch (LocationException le)
                {
                    System.err.println("Failed to retrieve a location provider");
                    System.err.println(le);
                    System.exit(0);
                }
            }
            catch (UnsupportedOperationException ue)
            {
                System.err.println("Require mode is unavailable");
                System.err.println(ue);
                System.exit(0);
            }
            return;
        }
    
        private class LocationListenerImpl implements LocationListener
        {
            public void locationUpdated(LocationProvider provider, Location location)
            {
                System.out.println("update location called");
                if(location.isValid())
                {
                    longitude = location.getQualifiedCoordinates().getLongitude();
                    latitude = location.getQualifiedCoordinates().getLatitude();
                    float altitude = location.getQualifiedCoordinates().getAltitude();
    
                    StringBuffer sb = new StringBuffer();
                    sb.append("Longitude: ");
                    sb.append(longitude);
                    sb.append("\n");
                    sb.append("Latitude: ");
                    sb.append(latitude);
                    sb.append("\n");
                    sb.append("Altitude: ");
                    sb.append(altitude);
                    sb.append(" m");
                    System.out.println("!!!!!!!Location update: " + sb.toString());
                    //MultipleFixDemo.this.updateLocationScreen(sb.toString());
                }
            }
    
            public void providerStateChanged(LocationProvider provider, int newState)
            {
                System.out.println("providerStateChanged called");
                // Not implemented
            }
        }
    
        class BrowserFieldScreen extends MainScreen
        {
            private BrowserField _browserField;
            private boolean _documentLoaded = false;
            private BrowserFieldRequest _request;
    
            /**
             * Creates a new BrowserFieldScreen object
             * @param request The URI of the content to display in this BrowserFieldScreen
             * @param enableScriptMenu True if a context menu is to be created for this BrowserFieldScreen instance, false otherwise
             */
            public BrowserFieldScreen()
            {
                super(Screen.HORIZONTAL_SCROLL | DEFAULT_CLOSE | DEFAULT_MENU);
                BrowserFieldRequest request = new BrowserFieldRequest("http://www.google.com");
    
                BrowserFieldConfig config = new BrowserFieldConfig();
                _browserField = new BrowserField(config);
                _browserField.addListener(new DemoBrowserListener());
                add(_browserField);
                _request = request;
            }    
    
            /**
             * @see Screen#onUiEngineAttached(boolean)
             */
            protected void onUiEngineAttached(boolean attached)
            {
                if(attached)
                {
                    try
                    {
                        _browserField.requestContent(_request);
                    }
                    catch(Exception e)
                    {
                        deleteAll();
                        add(new LabelField("ERROR:\n\n"));
                        add(new LabelField(e.getMessage()));
                    }
                }
            }
    
            /**
             * Returns this screen's BrowserField object
             * @return This screen's BrowserField object
             */
            public BrowserField getBrowserField()
            {
                return _browserField;
            }
    
            /**
             * A class to listen for BrowserField events
             */
            private class DemoBrowserListener extends BrowserFieldListener
            {
                /**
                 * @see BrowserFieldListener#documentCreated(BrowserField, ScriptEngine, Document)
                 */
                public void documentLoaded(BrowserField browserField, Document document)
                {
                    _documentLoaded = true;
                }
            }
        }
        private final static class MultipleFixScreen extends MainScreen
        {
            MultipleFixScreen()
            {
                super(DEFAULT_CLOSE | DEFAULT_MENU);
    
                RichTextField instructions = new RichTextField("Waiting for location update...",Field.NON_FOCUSABLE);
                this.add(instructions);
            }
        }
    }
    

    Any suggestions would be greatly appreciated.

    Thank you

    Jackie

    This is a limitation of the BrowserField.  The BrowserField also recorded a LocationListener that is use to power the GPS updates via JavaScript to pages it restores.  This LocationListener / that your application has already registered (given that the application can only record 1).

    There are two ways you can work around this problem.  You can save your LocationListener again after posting the BrowserField.  Note that if you take this approach methods JavaScript GPS won't within your BrowserField.

    The second approach is to poll for updates location, instead of using a LocationListener.  It should continue to work after posting a BrowserField.

  • Since update 10.0.2 at 6s "trash all ' in the Inbox.

    Since I did the update (10.0.2) I can no longer just "trash all ' mail inbox (Verizon).  Because I get emails 300 + a day, I need to be able to empty my Inbox easily without deleting all of them individually.  It is very irritating and time consuming.

    Anyway around this?  Thank you...

    sharikay wrote:

    Anyway around this?  Thank you...

    Not at the moment. Tell Apple you want to come back.

    http://www.Apple.com/feedback/iPhone.html

  • Uninstall software update Apple says error in seller contact package package unstaller

    Try to get itunes working to make a backup of my faulty iphone before repair.

    First-itunes does not start says error. I'm trying to fix it, who said success but same error when you try to start it.

    Then uninstall completely worked. Then reinstall that seemed to be over except for a message "an older version of Apple software update already exists" then he went down and install itunes apparently had not been completed.

    Then I try to remove the update from the apple software and executed by an error in the installation program - it says there is an error in the installation and contact the supplier of the installation package. Same error if I run the uninstall command line program.

    Try to repair the Apple Software Update of programs & features Control Panel and then try to update iTunes again.

    For general advice, see troubleshooting problems with iTunes for Windows updates.

    The steps described in the second case are a guide to remove everything related to iTunes and then rebuild what is often a good starting point, unless the symptoms indicate a more specific approach.

    Review the other boxes and other support documents list to the bottom of the page, in case one of them applies.

    The more information box has direct links with the current and recent if you have problems to download, must revert to an older version or want to try the version of iTunes for Windows (64-bit - for older video cards) as a workaround for problems with installation or operation, or compatibility with third-party software.

    Backups of your library and device should be affected by these measures but there are links to backup and recovery advice there.

    TT2

  • Since the update for Sierra, contacts do not appear in Messages - just phone numbers.

    Since the update for Sierra, Messages no longer displays Contact names - only phone numbers.  No instructions on how to remedy this.  Ideas?

    Hello

    Go into the Contacts application and ensure that it uses the same account synchronization like the iPhone and other devices you may be using.

    Also check the part of the accounts of the Contacts application preferences and make sure that it's only using one account.

    21:34 on Friday. 7 October 2016

     iMac 2.5 Ghz i5 2011 (El Capitan)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro (Snow Leopard 10.6.8) 2 GB
     Mac OS X (10.6.8).
     iPhone and iPad (2)

  • Problem after update 10.0.2 iOS iPhone touchscreen

    After I have updated to iOS 10.0.2, I noticed a problem with the touch screen. Using the position of the image on the right side, near the corner, the toushscreen does not work.
    For example: when you use the keyboard, I can't type the letter 'P', have trouble typing BACKSPACE. Using the Contacts app, I can't scroll through using the alphabet bar.

    Do what idea of the problem?

    Kind regards!

    Hi fabriciorela,

    Thanks for the upgrade to iOS 10! I understand that the right of your screen is unresponsive to the touch. You can try the steps in this link to fix the problem. If the screen of your iPhone, iPad or iPod touch does not respond to touch

    If it does not help the problem, try to restore the device to factory settings. I would like to backup your important data first.

    The backup of your iPhone, iPad and iPod touch

    Use iTunes on your Mac or PC to restore your iPhone, iPad or iPod to factory settings

    Please use the Apple Support communities to post your question. Let us know how it turns out. Have a great day.

  • USB disabled after the update of the Sierra (a short circuit and a work)

    Hi, when I bought my mbp 13 inches mid2012 (used, not new) I noticed that a USB port did not work. In the Yosemite sometimes I noticed that a USB port consumed too much energy and have been disabled. (I think because the usb port has been short-circuited. Year when it was time to update the mbp to El Capitan I had a few panic the kernel and the newspaper was shown as the last driver loaded the USB driver, so I kept the mbp with Yosemite. A few days ago, I updated for Sierra but only usb which used to work stopped working. It has enabled and turned on but Finder and disk utility does not see the drive. In an Apple dealer they said that could be established relationships with some oxide and next week will take it and see what the problem is.

    If there is someone with the same problems, please tell me what to do! I don't want to put in the trash my mac just for a flash drive... but I need!

    Hi Supermene,

    Thank you for using communities of Apple Support. Based on what you said, it appears as a USB device is not recognized in one of the USB ports. There are a few things that can cause this. I recommend you read these articles, which may be able to help solve the problem.

    macOS Sierra: If a USB device does not work

    Reset the management system (SCM) controller on your Mac.

    See you soon.

  • I can't go to my bookmarks after update for Sierra

    I have a MacBook Pro. I just updated this week to Sierra with no problems, but now when I click on multiple points in the upper left corner to reveal my favorites and my playlist only, it displays the top sites page and does not open my favorites and reading list, as it used to.

    Can someone tell me how to access my bookmarks and playlist in the Sierra? I'm sure it's something in the settings or something escapes me. My Bookmark Bar is the top of the page, yet. I can't find my bookmarks and reading list.

    Thank you

    I thought about it, I had to go to Favorites on top and tell Safari to display in the Sidebar again.

  • Calendar Apple App Bug frozen works only with iOS 10 update grrr

    Since I updated to iOS 10 (more more later than 10.2, etc.), everything was not too bad except THE APPLE CALENDAR app, its deiving me crazy when I click on the app it's like it freezes and past shift x 50 mode still something to do with the calendar app will cause either a frozen or a black screen or white and then crashed ack to main menu. Sometimes it will allow me to create but will be trolling with typing and finally crashed or not even save it... Please HELP I am sure what else to do, I tried to download google calendar and which seemed to have something of bug he loves too then something happens. And I tried to delete it and download it again, / force delivery, nothing has changed

    Hi there calsparks!

    Thank you for bringing your question on the calendar of freezing and trolling since the update to iOS 10 on your iPhone for Apple Support communities.  I rely on the calendar to keep my life organized, so I'm happy to help you resolve this issue today.

    Looks like you did a few good troubleshooting by force to leave the app, force to restart the iPhone and deleting and reinstalling the application calendar.  At this stage my next recommendation would be to backup your iPhone, then erase and restore your iPhone as a new device, then test calendar to see if it behaves correctly, and then restore your backup.

    The backup of your iPhone, iPad and iPod touch

    Use iTunes on your Mac or PC to restore your iPhone, iPad or iPod to factory settings

    Restore your iPhone, iPad or iPod touch from a backup

    Have a great day!

  • new iPhone update

    I have an iPhone 5 and will probably get an iPhone 6s with a new SIM from nano.

    My photos will remain on my iPhone 5 until I save them?  I don't want to put my new sim card in the iPhone 6 and then the old sim become inactive and lose my photos if that makes sense?

    Thank you

    Hello

    IPhone 5 should run ios 10.2 if not go to settings - about us - software update

    Do update on your WiFi.

    Then go to settings - iCloud backup now.

    The new iPhone set up on your WiFi when you are asked if you want to use iCloud backup say Yes.

    Use the same identifier apple then you will get all the apps / photos on the new iPhone.

    See you soon

    Brian

  • How to solve printing problems after update OS Sierra

    After the OS Sierra update, some of my files can not print from my printer. The message showed "internal error - an untrapped exception was raised. Choose 'continue' to continue execution in an inconsistent state. Choose 'Crash' to terminate the application and fill out a bug with Crash Reporter report. Choose 'Crash' will result in the loss of unsaved data. "Despite having chosen the above options, there is still nothing happen on the computer.

    Is there a way to fix this?

    Install a printer driver updated - check the site of the manufacturer for compatible drivers Sierra thew.

  • My App Store did not work... When I try to update or install apps it does not work. Can you please fix this?

    Can you please fix the problem? Appstore cannot update or install apps... App Store not worked yesterday.

    We cannot solve a problem for you, but we can make suggestions of troubleshooting...

    Have you tried restarting your iPhone yet?

    1. Press and hold the sleep/wake button until the Red slider appears.
    2. Drag the slider to turn off your device completely off.
    3. Once the device turns off, press and hold the sleep/wake button again until you see the Apple logo.
  • HI, Siri would not speak in Italian Luca voice after update for Sierra

    HI, why Siri not talk in Italian Luca voice after update to Sierra?

    Open (Apple menu) > System Preferences > accessibility > speech.

    Next to the system voice menu, select Customize...

    Scroll down to Italian, and then select Luca, and then click OK.

    It will take a few moments to download the new voice.

Maybe you are looking for