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
New Developer
Posts: 5
Registered: ‎07-17-2008
My Device: Not Specified

Unread message count displayed as 2 instead of 1

Hello,

I programmatically added a message to the folder of type Folder.INBOX inbox using the following code:

 

 

try {
final StringBuffer sb = this.getMessageString(textMsg, params);

final Message newInboxMsg = new Message();
newInboxMsg.setContent(sb.toString());
newInboxMsg.setFrom(_fromAddress);
newInboxMsg.setSentDate(new Date(textMsg.getCreateTimestamp()));
newInboxMsg.setInbound(true);
String subject = textMsg.getTextMessage();
newInboxMsg.setSubject(subject);
final Session session = Session.waitForDefaultSession();
final Store store = session.getStore();
final Folder[] folders = store.list(Folder.INBOX);
final Folder inbox = folders[0];
inbox.appendMessage(newInboxMsg);

} catch (final MessagingException e) {
// meh
}

 

 

I have two problems when I add a message this way:

1. The folder icon doesn't change as it does when I get real e-mail.

2. The unread message count icon (folder icon) show as 2 instead of 1. (Screenshot: check alert icon under Wi-Fi icon)

 

Erroneous alert

 

I see the same behavior on the sim as well as device. Is there anything that I am doing wrong?

 

Regards

Rohit

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Unread message count displayed as 2 instead of 1

For #1, the messages application doesn't display the red "splat" when you programmatically display a message.

 

For #2, are you saying that the undread message count is 0 (not shown) but then shows up as 2 unread messages when you add your new message (and there are no other unread messages)?  If so, what BlackBerry model and handheld software version are you testing on?  You can find this under Options, About on the BlackBerry.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 5
Registered: ‎07-17-2008
My Device: Not Specified

Re: Unread message count displayed as 2 instead of 1


For #2, are you saying that the undread message count is 0 (not shown) but then shows up as 2 unread messages when you add your new message (and there are no other unread messages)?  If so, what BlackBerry model and handheld software version are you testing on?  You can find this under Options, About on the BlackBerry.

Correct. It goes from 0 to 2.

Device info:

Blackberry 8820

v 4.2.2.169 (Platform 2.4.0.67)

 

New Developer
Posts: 5
Registered: ‎07-17-2008
My Device: Not Specified

Re: Unread message count displayed as 2 instead of 1

Is there any way I can achieve # 1?

 

Regards

Rohit

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Unread message count displayed as 2 instead of 1

There is no way to achieve #1 programmatically.

 

I have been able to reproduce #2 and have also verified that the issue is fixed in BlackBerry handheld software version 4.5.0.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 5
Registered: ‎08-26-2008
My Device: Not Specified

Re: Unread message count displayed as 2 instead of 1

I have also encountered the same problem, even on the new 4.5 simulator. The counter still increases by 2.

The #1 problem can be solved using "msg.setStatus(Message.Status.RX_RECEIVED, 1);". When the message is opened, the icon is changed. However, I still don't know how to show the message as received in blue instead of having it yellow.

 

Regards

 

ftoure

 

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Unread message count displayed as 2 instead of 1


ftoure wrote:

 However, I still don't know how to show the message as received in blue instead of having it yellow.

 

 


Can you elaborate on what you mean here?  What are you trying to change the colour of?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 5
Registered: ‎08-26-2008
My Device: Not Specified

Re: Unread message count displayed as 2 instead of 1

Here are the different kind of messages that I found, playing with different parameters: received not opened, received (doesn't change when opened), opened. It sounds that there are some other possible states, for example, when an SMS is received, the envelop is blue. The yellow envelop is the standard behaviour for a received mail. The only remaining problem is the counter that increases 2 by 2.

 

Notifications

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Unread message count displayed as 2 instead of 1

I'm not able to view the image you posted.  The URL seems to point to you hard drive.  Do you have a public URL of the image?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 5
Registered: ‎08-26-2008
My Device: Not Specified

Re: Unread message count displayed as 2 instead of 1

Here is a public URL of the picture: