HomeScreen.UpdateIcon while

If I try to change the icon of my application using HomeScreen.UpdateIcon, as the icon of the application focuses the change does not appear until I have move the focus to another element.
Is there a way to force a repaint them?

I tried Ui.getUiEngine () .repaint () or updateDisplay() without success.

If I re-change the icon to the old icon update is done at the same time.

Thanks for reporting this.  I sent this question to our development team.

Tags: BlackBerry Developers

Similar Questions

  • Œuvres of HomeScreen.updateIcon but .setName doesn't work!

    Hi people. It is a continuation of a problem with the fact that I had a while back on the forum, Mr. Sohm has helped. When I try to the line of code:

    HomeScreen.setName (myString);

    I get the error:

    Module with handle [2584] and [0] index has no application entry point

    and yet, when I use the similar functionality:

    HomeScreen.updateIcon (Bitmap.getBitmapResource ("green.png"));

    It works very well! I use the v4.6 devenv with the Simulator "BOLD". My application has 2 projects, a module of the app CLDC system that starts automatically on startup and an application entry replacing cldc point, with my icons. My application runs at the start of the phone and did a thing and also runs when you click the icon (and does other stuff). It gives the same error if you try to setName at startup or when the click on icon.

    Everything works fine for updateIcon, but for some reason setName any gives error! Any help appreciated (code?)!

    Justin Dutoit

    Looks like you are trying to set the wrong name about to enter.

    Looking at your description. It seems to me.

    Module system APP CLDC (where the source code). Index must be 0.

    Entry point for CLDC. Index must be 1.

    What happens is that HomeScreen.updateIcon (Bitmap.getBitmapResource ("green.png")); fact on index 1 by default.

    I haven't used before setName(), but it seems that HomeScreen.setName (myString) on index 0 by default.

    My suggestion is to call

    HomeScreen.setName(myString, 1);
    

    Hope that helps

  • HomeScreen.updateIcon updates the bad background application

    I have an application with two entry points. A single point of entry runs as a background application to listen to calendar changes. When the Exchange Calendar I need to change my icon on the home screen to the GUI of my app app part. However, if I am in another application when the event occurs, the current application has its icon has changed.

    I know that there is another version of updateIcon() in 4.7, but how do I handle this in older versions of the operating system?

    Use a global event to send a message to your Application that the calendar has changed.  Your application can then some he wants, including the amendment of the application icon.

    What is - world events and global event listeners
    Article number: DB-00145
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/What_Is...

  • HomeScreen icon does not update correctly

    I'm trying to update my HomeScreen iconwith copy the following code:

    UiApplication.getUiApplication().invokeAndWait(new Runnable() {
         public void run() {          HomeScreen.updateIcon(IMAGE_NEW,0);
         }
    });
    

    It generally works well, with one exception: on the Storm, if the home screen is in this limited view where it shows that two or three rows of icons, the icon is not updated until the application icon focus is changed, or if the orientation is changed to landscape mode. Is there something wrong in the way I update the icon? It works fine when I'm in the mode where all the icons are available (i.e. after hitting the button menu).

    You do not have something wrong, that it is a limitation of the current home screen API.  Our development team is aware of this problem.

  • HomeScreen problem of icon on the storm

    I use the OS 4.7 storm and

    my application is updating the using appIcon

    HomeScreen.updateIcon (_bitmap, 0);

    It works fine, but it will not update the appIcon if I move my application in the folder of the House where it displays the

    wallpaper in Portrait mode.

    also if you move around the appicons then the icon is updated.   It seems that the home screen is not updated the icon as it suppose too.

    Anyone have this problem?

    Yes, the first post was in 2008.

    BTW, on tour with OS 4.7.1 that this works.

  • Cultures of the homescreen icons update

    I have an icon 32 x 32 pixels of the home screen.  The meat and potatoes of the image is a circular graphic 30 x 30, centered on the image.  All the surrounding pixels are transparent.

    To implement some sort of notification on the homescreen, I superimpose a 15 x 15 icon in the upper left corner of the home screen of 32 x 32 icon and use HomeScreen.updateIcon (Bitmap).

    After calling updateIcon(), the icon appears cropped on the edge of the pie chart 30 x 30.

    Front

    After

    This cropping only occurs when the notification icon is drawn on a portion of the icon to the home screen which has under transparent pixels (seems the operating system creates a mask by reversing the transparent pixels or something?).

    Any ideas?

    (Edit: tested on 4.3, 4.5, 4.6 simulators)

    This problem has been reported to our development team.

  • Display of sizes of different icons on different devices

    I'm trying to dynamically set a different icon based on the device. I've set up another point of entry in the xml of the application descriptor file. It passes an argument of "icon" in my application main().

    The entry point is triggered as expected (installation of the application and to the power of the cycle), but he has problems when calling updateIcon() on some phones (for example BB 8900 T-Mobile version 4.6.1.231 (Platform 4.2.0.108)). Looks like it fails on phones with OS 4.7 and works very well on phones on or above this level.

    The error I get is IllegalArgumentException: "Module with handle [XXXX] and [X] index has no application entry point. Try to set the index to both 0 and 1 on updateIcon() has the same problem.

    It is only happening when I install the application OTA (works on the 8900 charging cable).

    I have my code below from from the section of this topic:

    public static void main(String[] args) { if ( args != null && args.length > 0 && args[0].equals("icon") ){      MyApp instance = new MyApp(true); } else {      MyApp instance = my MyApp(false); } instance.enterEventDispatcher();}
    
    public MyApp(boolean autostart){   if(autostart){        Bitmap loadedIcon;        int width = HomeScreen.getPreferredIconWidth();       int height = HomeScreen.getPreferredIconHeight();
    
          //conditional logic to initialize "loadedIcon" based on device icon width
    
          final Bitmap icon = loadedIcon;       invokeLater(new Runnable(){                 public void run(){                    ApplicationManager myAppManager = ApplicationManager.getApplicationManager();                     boolean keepGoing = true;                     while (keepGoing){                        //Check if the BlackBerry has completed its startup process.                          if (myAppManager.inStartup()){                            //The BlackBerry is still starting up, sleep for 1 second.                            try {                                 Thread.sleep(1000);                           } catch (Exception ex) {                                //Couldn't sleep, handle exception.                             }                         } else {                              //The BlackBerry has finished its startup process.                            //Set the rollover icons.                             try {                                 HomeScreen.updateIcon(icon, 0);                               HomeScreen.setRolloverIcon(icon, 0);                              } catch(Exception e){                                   System.out.println("setting icon caught: " + e.getMessage());                                 e.printStackTrace();                            }                             keepGoing = false;                        }                     }                     //Exit the application.                   System.exit(0);               }             }); } else {      //load the app normally, with UI. }}
    

    I use Eclipse plug-in 1.1.2 to build my app, but article is older, obsolete 1.0 plugin, maybe the instructions no longer apply and must be updated?

    Understood the problem, basically it is a condition of race as described here which is also in addition to restarting the device. It happens when the application is installed OTA and the entry point to attempts to define the icon when the application is not fully registered with the device. In a Word, it is the valid response (in invokeLater):

    int failedTries = 0; //failed attempt counter (maximum of 5 attempts for this example)public void run(){                     ApplicationManager myAppManager = ApplicationManager.getApplicationManager();                     boolean keepGoing = true;                     while (keepGoing){                        //Check if the BlackBerry has completed its startup process.                          if (myAppManager.inStartup()){                            //The BlackBerry is still starting up, sleep for 1 second.                            try {                                 Thread.sleep(1000);                           } catch (Exception ex) {                                //Couldn't sleep, handle exception.                             }                         } else {                              //The BlackBerry has finished its startup process.                            //Set the rollover icons.                             try {                                 HomeScreen.updateIcon(icon, 0);                               HomeScreen.setRolloverIcon(icon, 0);                                          keepGoing = false;                                          //Icon should of been set at this point                             } catch(Exception e){                                 System.out.println("setting icon caught: " + e.getMessage());                                 e.printStackTrace();                                          failedTries++;                                    try {                                     Thread.sleep(2500);                               } catch (Exception ex) {                                    //Couldn't sleep, handle exception.                                 }                                          //Since the attempt failed, we sleep for two and a half secs and try again.                              }                             if(failedTries > 4){                               //Worst case. Should revert to a default icon if it fails to be set after five tries.                                 keepGoing = false;                            }                         }                     }                     //Exit the application.                   System.exit(0);               }
    

    Catch the exception, and then sleep for about two seconds and leave the loop to set the icon again, because it will succeed on the second or third try (at that time that the app must be registered with the device, including its entry point). In addition, to ensure a maximum test because you do not want to create a possibility of an infinite loop if for some reason, it fails to set the icon each time.

  • Simualtor + RMS

    Hi all

    I made a request in which I am using RMS.

    It works fine when I compile and run using JDE 4.3.

    But when I use the cod file and run it on any one of the simulators downloaded gives exception and not of RMS data.

    Help, please.

    Thank you

    Stephenson

    class UM extends UiApplication
    {
        
    Display MS = null;
        
    UM()
    {
    MS = new MainScreen();
    Ui.getUiEngine () .pushScreen (MS);
    } //End consrtuctor
        
     
    Public Shared Sub main (String [] args)
    {
            
    If (args! = null & args.length > 0 & args [0] .equals ("auto"))
    {
    UM U = new UM();
    U.enterEventDispatcher ();
    } //end of if
    on the other
    {
    AlwaysRunThread alwaysRunThread = new AlwaysRunThread();
    Thread runInBackGround = new Thread (alwaysRunThread);
    runInBackGround.start ();
    } //end of else
    } //end of MAIN()
        
    } //End of CLASS UM() +++

    //++++++++Class++++++++++++
    class AlwaysRunThread extends Thread
    {
       
    AlwaysRunThread()
    {
    }
        
    public void run()
    {
    Icon bitmap = Bitmap.getBitmapResource ("desktop_icon.png");
                  
    While (true)
    {
    System.out.println ("* BACKGROUND THREAD RUNNING *");
    Try
    {

    HomeScreen.updateIcon(icon,1);

    thread. Sleep (10000);
    }
    catch (System.Exception e)
    {
    System.out.println ("Exception in the thread sleep:" + try ());
    }
                
    } //end of while()
            
    } //end of the run() method
        
    } //end of class

  • How to substitute Entry Points with new JDE Plugin 1.1

    With the old plugin make you a separate project and assign as another point of entry CLDC and give him args like "gui" and check for it in the code like this:

    public class UImain extends UiApplication
    {
    
            public UImain(boolean autoStart) {
    
            if (autoStart)
                {
                // If the application started using the auto start
        // entry point, we setup the our icons.
    
        invokeLater(new Runnable() {
    
            Bitmap regularIcon = null;
            Bitmap rolloverIcon = null;
    
            private int round(double d){
                String s = Double.toString(d);
                int returnI;
                double decimal = 0;
                s = s.substring(s.indexOf("."), s.length());
                decimal = Double.parseDouble(s);
                if(decimal >= .5){
                    returnI = (int) Math.ceil(d);
                } else {
                    returnI = (int) Math.floor(d);
                }
                return returnI;
            }
    
            public void run() {
    
                int height = HomeScreen.getPreferredIconHeight();
                  switch(height){
                    case 32:
                        regularIcon = EncodedImage.getEncodedImageResource("icon.png").scaleImage32(
                                  Fixed32.toFP(3), Fixed32.toFP(3)).getBitmap();
                        rolloverIcon = EncodedImage.getEncodedImageResource("icons/roll.png").scaleImage32(
                                  Fixed32.toFP(3), Fixed32.toFP(3)).getBitmap();
                        break;
                    case 48:
                        regularIcon = EncodedImage.getEncodedImageResource("icon.png").scaleImage32(
                                  Fixed32.toFP(2), Fixed32.toFP(2)).getBitmap();
                        rolloverIcon = EncodedImage.getEncodedImageResource("icons/roll.png").scaleImage32(
                                  Fixed32.toFP(2), Fixed32.toFP(2)).getBitmap();
                        break;
                    default:
                        regularIcon = EncodedImage.getEncodedImageResource("icon.png").scaleImage32(
                                Fixed32.toFP(round(96.0 / height)), Fixed32.toFP(round(96.0 / height))).getBitmap();
                        EncodedImage a = EncodedImage.getEncodedImageResource("icons/roll.png");
                        rolloverIcon = a.scaleImage32(
                                Fixed32.toFP(round(96.0 / height)), Fixed32.toFP(round(96.0 / height))).getBitmap();
                        break;
                  }
    
                ApplicationManager myApp =
                ApplicationManager.getApplicationManager();
                boolean inStartup = true;
                while (inStartup)
                {
                    if (myApp.inStartup())
                    {
                        // Wait for the device to finish the startup
                        // process.
                        try {
                            Thread.sleep(1000);
                        } catch (Exception ex)
    
                        {
                            // TODO: Couldn't sleep, handle exception.
                        }
    
                    } else {
                        try {
                            HomeScreen.updateIcon(regularIcon, 2); //This "1" indicates second entry point icon, refers to ribbon
                            HomeScreen.setRolloverIcon(rolloverIcon, 2);
                            inStartup = false;
                        } catch (Exception ex) {
                            // Couldn't set the rollover icon, handle exception
                        }
                    }
                }
                // We're done setting up the icons. Exit the app.
                System.exit(0);
            }
        });
    
        } else {
        // The application was started by the user, display the UI.
            pushScreen(new RitisTitleScreen());
    }
    

    It doesn't work anymore, I don't see an option for an alternative project entry point. How can we do this using the new plugin?

    Open your BlackBerry App descriptor file and you will see three tabs at the bottom. Go to the last tab and add your AEPS.

    No need to another don't project now (which is great).

  • Definition of an icon of overview

    I set up a test application to try to define a rollover icon and followed the advice in the following articles in the Knowledge Base

    and also, in this thread http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=3623

    I put the index according to the thread above in the following API calls:

    HomeScreen.updateIcon( regIcon, 1 );
    HomeScreen.setRolloverIcon( icon, 1 );
    

    I installed the same sample application on a 8100 device and a 8310 device.  8100 system works perfectly, but the 8310 device sends a message error "Module with handle [handleID] and [index] has no application entry point.

    Does anyone know why it would work on a single device, but not another?  Is there a way to fix this?

    public RolloverTest(boolean autoStart)
    {
        if (autoStart)
        {
            //The application started using the auto start entry point.
            //Setup the rollover icons.
            final Bitmap regIcon = Bitmap.getBitmapResource("mobicon_36x36.png");
            final Bitmap icon = Bitmap.getBitmapResource("mobicon_36x36_highlight.png");
    
            invokeLater(new Runnable()
            {
                public void run()
                {
                    ApplicationManager myApp = ApplicationManager.getApplicationManager();
                    boolean keepGoing = true;
    
                    while (keepGoing)
                    {
                        //Check if the BlackBerry has completed its startup process.
                        if (myApp.inStartup())
                        {
                            //The BlackBerry is still starting up, sleep for 1 second.
                            try
                            {
                                Thread.sleep(1000);
                            }
                            catch (Exception ex)
                            {
                                //Couldn't sleep, handle exception.
                            }
                        }
                        else
                        {
                            try
                            {
                                //The BlackBerry has finished its startup process.
                                //Set the rollover icons.
                                HomeScreen.updateIcon(regIcon, 1);
                                HomeScreen.setRolloverIcon(icon, 1);
                                keepGoing = false;
                            }
                            catch (Exception ex)
                            {
                                // Couldn't set the rollover icon, handle exception
                            }
                        }
                    }
    
                    //Exit the application.
                    System.exit(0);
                }
            });
        }
        else
        {
            //The application was started by the user.
            //Start the application and display a GUI.
            pushScreen(new ScrTest());
        }
    }
    

    I've been playing in this code example, a little bit more and added a try/catch statement (highlighted in red in the example above) around the code to set the icon of overview.  Overview icon now works every time and I no longer see the error message.  Hurrah!

  • Pack component 4.7 - Overview icon does not change

    Hello

    I use Eclipse.  Compilation with BB component pack 4.7.

    I have a master project (CLDC) and a second project (CDLC replacement Entry Point). The second project is checked system and startup.

    Note: the second entry point was to record a personalized for the app, not on the icon menu item.

    I right click on the "main" project-> properties-> Blackberry Project Properties-> resources.

    I select an icon file (1.png) in the dialog box "files of icons".

    I select a second (2.png) icon file in the "Icons of focus files" dialog box.

    I clean, compile, run under a 'new' "BOLD" Simulator (9000) and my app has the icon "no-focus".

    When I reversal, it does not change.

    What I've read, 4.7 is supposed to make this easy.  It seems to be advantageous, so I don't know I'm missing something that is obvious (to everyone except me).  I am new to Java and Eclipse, but really get the hang of it... so far, it's...

    Does anyone have any ideas why this might not work?

    Thank you!

    You project must have an entry point with parameter. This additional entry point must be defined as "Autostart". Add the parameter's main entry: gui

    And check the code below. This works.

    import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen;import net.rim.device.api.system.Bitmap;import net.rim.device.api.system.ApplicationManager;import net.rim.blackberry.api.homescreen.HomeScreen;
    
    public class HomeScreenIcon extends UiApplication{    public static void main(String[] args)    {        //Check for the argument defined in the project properties.        if (args != null && args.length > 0 && args[0].equals("gui"))        {           HomeScreenIcon theApp = new HomeScreenIcon(false);            theApp.enterEventDispatcher();        }        else        {            HomeScreenIcon theApp = new HomeScreenIcon(true);            theApp.enterEventDispatcher();        }    }    public HomeScreenIcon(boolean autoStart)    {        if (autoStart)        {        //The application started using the auto start entry point.        //Setup the rollover icons.        final Bitmap regIcon = Bitmap.getBitmapResource("1.png");        final Bitmap icon = Bitmap.getBitmapResource("2.png");
    
            invokeLater(new Runnable()        {            public void run()            {                ApplicationManager myApp =                  ApplicationManager.getApplicationManager();                boolean keepGoing = true;
    
                    while (keepGoing)                {                    //Check if the BlackBerry has completed its startup process.                    if (myApp.inStartup())                    {                        //The BlackBerry is still starting up, sleep for 1 second.                        try                        {                            Thread.sleep(1000);                        }                        catch (Exception ex)                        {                          //Couldn't sleep, handle exception.                        }                    }                    else                    {                        //The BlackBerry has finished its startup process.                        //Set the rollover icons.                        HomeScreen.updateIcon(regIcon, 0);                        HomeScreen.setRolloverIcon(icon, 0);                        keepGoing = false;                    }                 }                 //Exit the application.                 System.exit(0);            }        });
    
        }    else    {         //The application was started by the user.         //Start the application and display a GUI.         MainScreen ms = new MainScreen();         ms.setTitle(new LabelField("Hello there."));         pushScreen(ms);    }  }}
    
  • Size of the application icon... Home screen will not use the right one. Help!

    I thought I could include different sizes of icons (ie. 48 x 48, 32 x 32, etc.) and the camera choose the size of the device or the theme-appropriate application icons. Of course, this isn't the case. So, how do you get the device to use the right size for the theme icon?

    For example, I have a Verizon 8330 (curve) and the theme of Verizon uses sizes 48 x 48 icons. If I use a size of 48 x 48 icon to my app, it looks great. However, if I change the theme of one of the standard BB Dimension themes, it will be small scale my icon 48 x 48, 32 x 32, which seems quite bad. Why does not he chooses the icon size 32 x 32 I understand? How can I provide both sizes and have it use the correct size according to the theme? It looks even worse when I use 32 x 32 and he then it extends to 48 x 48. Help!

    You'll have to do it by programming it your application startup.  You can use the following code to get the width and height of the icon:

    int height = net.rim.blackberry.api.homescreen.HomeScreen.getPreferredIconHeight();
    int width = net.rim.blackberry.api.homescreen.HomeScreen.getPreferredIconWidth();
    

    Then set the using the appropriate icon:

    net.rim.blackberry.api.homescreen.HomeScreen.updateIcon( icon );
    
  • HomeScren.supportsIcons () throws a RuntimeException

    When the following code is executed on a device or a simulator with OS 6.0 that has an active theme with a GIF animated for the bottom of the home screen, a RuntimeException ' Index 1 > = 1 ' is thrown:

    try {
        updateIcons();
    } catch (RuntimeException e) {
        Logger.logError("Runtime exception: " + e.getMessage());
    }
    private void updateIcons() {
        Logger.logDebugInfo("updateIcons");
    
        if (HomeScreen.supportsIcons()) {
            Logger.logDebugInfo("The current theme supports icons");
            HomeScreen.updateIcon(Bitmap.getBitmapResource("Main Icon.png"), 0);
            Logger.logDebugInfo("main icon updated");
            HomeScreen.setRolloverIcon(Bitmap.getBitmapResource("Main Icon Active.png"), 0);
            Logger.logDebugInfo("rollover icon set");
        } else {
            Logger.logDebugInfo("The current theme does not support icons");
        } 
    
        Logger.logDebugInfo("End of updateIcons");
    }
    

    The recorder is a wrapper class for net.rim.device.api.system.EventLogger.

    The output of the code above in the event log is:

    updateIcons
    Runtime exception: Index 1 > = 1

    If I remove the "if (HomeScreen.supportsIcons ()) ' line and the line"else", all right:

    updateIcons
    The current theme is supported by the icons
    main icon updated
    Turning icon set
    End of updateIcons

    I ran the code snippet at the start of the application, on the application of another point of entry starts and the menu command, click on and the result was always the same.

    I created the application with BlackBerry Plugin for Eclipse Eclipse 3.4 (for BB OS4.7) v1.2, then I tried with BlackBerry Plugin for Eclipse v1.3 in Eclipse 3.6 (for BB OS6), but there was no difference in the behavior of HomeScreen.supportsIcons () on OS6.0 - he always threw a RuntimeException if the active theme had specified a theme animated for the bottom of the home screen.

    The exception is thrown when the background is an animated GIF (no matter how it has been set to loop - forever or just once), but never when it's a static image or a slideshow.

    So, I wonder if the supportsIcons check is really important and what would happen if the code is run on a device that uses a theme without icons (I have personally never met such person).

    And, of course, my big question is: is this a bug or I do something wrong?

    Thanks for the themes of the sample.  I was able to reproduce using them.  I reported this problem to our development team and it connected Issue Tracker here: https://www.blackberry.com/jira/browse/JAVAAPI-1796

  • Enry Point on Storm application error

    I spent some time getting my application to work correctly with multiple entry points.  After the articles, I have now a main GUI application and also an autostart module which, among other things, updates the main icon.  I use the technique of the call launch() with some settings special (like "updateIcon") to get the correct behavior. Things work well.

    So I'm now doing a lot of testing in-depth on different platforms and a mysterious error arises.  When the storm running Simulator and the installation of the app the OTA (not just the race to Eclipse) method, I get an error when the installation is complete: "untrapped Exception. Module with handle [6952] and [0] index has no application entry point '. '.  After a reboot, everything works fine, I do not see the error, and the icon is updated in the background, OK.

    It's the offending section:

    UiApplication.getUiApplication () .invokeAndWait (new Runnable() {}
    public void run()

    If I comment the line below, I don't see the error at all.

    HomeScreen.updateIcon(bitmap,0);
    }
    });

    I am currently taking the low road and just trapping the IllegalArgumentException around updateIcon appeal, but I do not like this solution.

    Why this ugly error does not only appear during installation?

    Thank you

    Jim

    I might have found a solution!

    An idea that I had was that the other point of entry that runs at startup (and apparently starts right after installation) could start before the main entry point (0) is installed/related in / ready to go/etc.  I tested it by putting Thread.sleep (1000) as the first thing that the other point of entry, and it seems to work!  I don't know the details under the hood on how these modules get installed or started, but the notion of a race condition critical could explain both what I'm seeing and why its not appear in other platforms and/or any from methods (eg. no problems during the eclipse everything starts up).

    I will test some more and it keep it open for a comments for a few days before marking as resolved.

    Thank you

    Jim

  • Badge notification (Red Star) on the home screen

    I have indicators of demand down. I also went through the demo API notifications, but I don't see how to get the Red badge/star appears on my application icon when a new notification arrives.

    I want to show him even if the application is located in a folder. How can I go about it?

    We use two icons - the one with the Red Star, the other without.

    The application uses Homescreen.updateIcon () to change the icon when notifications are pending.

Maybe you are looking for