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
Contributor
shivdattam
Posts: 40
Registered: ‎10-22-2010
My Device: 9800 Torch
My Carrier: AirTel

Mark Mail(Message) as Read or Opened

Hi all,

 

I am using following code to Mark Mails from inbox as Read(Opened)

 

for(int i =0;i<inbox.getMessages().length;i++){
                String receivedDate = dateFormat.format(inbox.getMessages()[i].getReceivedDate());
                if(inbox.getMessages()[i].getFrom().getAddr().equals(messageDTO.getFromAddr()) && receivedDate.equals(messageDTO.getDateTime())){
                    inbox.getMessages()[i].setFlag(Message.Flag.OPENED,true);
                    break;
                }            
        }

 

This works well in simulator but doesnt work on actual device.

 

Any help is appreciated.

 

Thank You,

Shivdattam.

Please use plain text.
Developer
simon_hain
Posts: 16,017
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Mark Mail(Message) as Read or Opened

check with a debugger if the correct message is found and the flag is set.
we set the flag and it works iirc.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
shivdattam
Posts: 40
Registered: ‎10-22-2010
My Device: 9800 Torch
My Carrier: AirTel

Re: Mark Mail(Message) as Read or Opened

Hi Simon,

 

Thanks for your quick reply.But when i print lenght of Inbox using "inbox.getMessages[].length",though there are messages in Inbox length is given as Zero(0).

 Thanks,

Shivdattam.

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Mark Mail(Message) as Read or Opened

You might want to check aplication permissions.

 

Please use plain text.
Contributor
shivdattam
Posts: 40
Registered: ‎10-22-2010
My Device: 9800 Torch
My Carrier: AirTel

Re: Mark Mail(Message) as Read or Opened

hi Rex,

 

Thanks for reply but may i know how to set application permissions.Is is the same while installing application prompts up.I have already given permissions to that.If what u r saying is different then please let me know.

 

Thanks,

Shivdattam.

Please use plain text.
Developer
simon_hain
Posts: 16,017
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Mark Mail(Message) as Read or Opened

check if the rim samples to access the inbox work.
if not, you have another problem. if they work, check the differences to your code.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.