Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel
Accepted Solution

Notification Icon

Hello every one...

 

I am getting a problem in increasing notification icon's  value... it increases for the first time and then it does n0t increase after that for subsequent event calls. I have initialized its vaue (0) also outside the function where its called... still.... please help...

 

Thank you in Advance...

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Notification Icon

What is your code for updating the notification count?

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Notification Icon

Thanks for the reply...

Here's my Code...

 

final class StartScreen extends MainScreen   {


....

 

 

      int mValue;

....

 

 

EncodedImage _iImage = EncodedImage.getEncodedImageResource("smspopup_icon.png");
    ApplicationIcon _iIcon = new ApplicationIcon(_iImage);

    ApplicationIcon mIcon = _iIcon;
    
    
    
private void registerIndicator() {
        try {
                ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
                ApplicationIndicator indicator = reg.register(mIcon, false, true);
        }
        catch (Exception e) {
        }
    }

void updateValue(int value) {
        try {
                ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
                ApplicationIndicator appIndicator = reg.getApplicationIndicator();
                appIndicator.setValue(value);
        }
        catch (Exception e) {
        }
    }
 void updateIcon(ApplicationIcon icon) {
        try {
                ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
                ApplicationIndicator appIndicator = reg.getApplicationIndicator();
                appIndicator.setIcon(icon);
        } catch (Exception e) {
        }
    }

 ....




public void saveShow() {
StoreInfo info1 = new StoreInfo();
 
try{
info1.setElement(StoreInfo.TIME, time);
info1.setElement(StoreInfo.MESSAGE, payloadS);
info1.setElement(StoreInfo.PHONE, sender);

SmsHide._shData.addElement(info1);

synchronized(SmsHide.storeS) {
SmsHide.storeS.setContents(SmsHide._shData);
SmsHide.storeS.commit();
}
}
catch(Exception e){
    System.out.println(e);
}
registerIndicator();
mValue++;
updateValue(mValue);
updateIcon(mIcon);


int trigger = NotificationsConstants.CRITICAL;
long timeout = -1;
Event e = new Event(SmsHide.NOTIFICATIONS_ID_1, _eventId, 500, timeout,trigger );
_eventId++;
e.fire();
}

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Notification Icon

Plz help... Sry for delay in reply... I was out of station..

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Notification Icon

[ Edited ]

You might be receiving an error. Since you are not printing the error or the stack trace in your try...catch blocks, you may not see why it isn't updating.

 

Try adding:

 

e.printStackTrace();

 

to all of your try..catch blocks within the catch block.

 

 

try {
  // CODE
} catch(Exception e) {
   e.printStackTrace();
}

 

 

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Notification Icon

Thanks for the Reply...

I will do that... and tell you the result...

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100

Re: Notification Icon

I had to do

   appIndicator.setValue(value);    

   appIndicator.setVisible(true);

 

 

I don't know if it's the same situation.

Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Notification Icon

Hello,

I did as u said and ran it...

 

It again did fine for the first time but the counter value then stopped increasing... it never increased to 2 after 1.... hers what i get on the cosole of JDE...

(This is for two attempts...) I applied icon notification paasword screen(consisting of passwordField) opens after pressing a button form startscreen....

 

 

 

FocusHistory: Focus lost; App SMS and MMS; Component Sms.StartScreen$6
FocusHistory: Focus gained; App SMS and MMS; Component net.rim.device.api.ui.component.PasswordEditField
22 Apr 2010 06:03 net.rim.device.apps.internal.virtualkeyboard.control.virtualKeyboard.ConfigInfo hasLayoutChanged:
INFO: Keypad layout changed from 1414738484 to 1414738226
22 Apr 2010 06:03 net.rim.device.apps.internal.virtualkeyboard.control.virtualKeyboard.VirtualKeyboardScreen notifyInputContext:
INFO: New keypad layout = 1414738226
22 Apr 2010 06:03
WARNING: setKeyboardControl(): unnecessary call.  Current control identical to argument
FRIDG: could not find caret_blueglass__Landscape.png
JVM: bklt @9763: timer
JVM: bklt[1] @9763: idle 6
JVM: bklt @9763: setTimer 16
VM:+GC(f)w=11
VM:-GCt=7,b=1,r=0,g=f,w=11
VM:+CR
VM:TI2Rv=100
VM:-CR=2
22 Apr 2010 06:04 net.rim.device.apps.internal.virtualkeyboard.control.virtualKeyboard.ConfigInfo hasLayoutChanged:
INFO: Keypad layout changed from 1414738226 to 1414738484
22 Apr 2010 06:04 net.rim.device.apps.internal.virtualkeyboard.control.virtualKeyboard.VirtualKeyboardScreen notifyInputContext:
INFO: New keypad layout = 1414738484
JVM: bklt @11824: timer
JVM: bklt[1] @11824: idle 0
JVM: bklt @11824: setTimer 22
22 Apr 2010 06:04 net.rim.device.apps.internal.virtualkeyboard.control.virtualKeyboard.ConfigInfo hasLayoutChanged:
INFO: Keypad layout changed from 1414738484 to 1414738226
22 Apr 2010 06:04 net.rim.device.apps.internal.virtualkeyboard.control.virtualKeyboard.VirtualKeyboardScreen notifyInputContext:
INFO: New keypad layout = 1414738226
22 Apr 2010 06:04
WARNING: setKeyboardControl(): unnecessary call.  Current control identical to argument
VM:+GC(f)w=11
VM:-GCt=6,b=1,r=0,g=f,w=11
VM:+CR
VM:-CR=3

 

 

Please Help I dont know where I am going wrong and I really need this solution...

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Highlighted
Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: Notification Icon

[ Edited ]

I'm not sure. Maybe setIcon resets the number?

Here is my code that works well. Please try: 

 

public class Blackberry46 extends Blackberry
{
    private static final ApplicationIcon icon = new ApplicationIcon(EncodedImage.getEncodedImageResource("notify-icon.png"));
    private static final ApplicationIndicator indicator;

    static
    {
        indicator = ApplicationIndicatorRegistry.getInstance().register(icon, false, true);
    }

    public Blackberry46()
    {}

    public boolean isApplicationIndicatorSupported()
    {
        return true;
    }

    public void setApplicationIndicatorValue(int count)
    {
        if (count > 0)
        {
            indicator.setVisible(true);
            indicator.set(icon, count);
        }
        else
            indicator.setVisible(false);
    }

    public void exit()
    {
        setApplicationIndicatorValue(0);
        super.exit();
    }
}

 

 

Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: Notification Icon

Thanks for the reply... I'll try and let you know the outcome...

 

Regards

 

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S