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
jeyaprakash
Posts: 33
Registered: ‎07-16-2008
My Device: bold

Get mail Status

Hi all

           how to delete an email after its delivered i get mail status using 

mail.getStaus();

 it returns only an int value how to get mail status like TX_DELIVERED or TX_PENDING

                     

                  

 

BlackBerry Development Advisor (Retired)
mweitzel
Posts: 28
Registered: ‎07-14-2008
My Device: Not Specified

Re: Get mail Status

Compare the returned integer against the Message.Status constants, if the return value you got equals the Message.Status.TX_DELIVERED then you should be able to procede with your deletion. 

New Developer
jeyaprakash
Posts: 33
Registered: ‎07-16-2008
My Device: bold

Re: Get mail Status

int status=mail.getStatus(); if(status==Message.Status.TX_DELIVERED) { mail.getFolder().deleteMessage(mail): }

  status retuns some value like 41576834 ?

BlackBerry Development Advisor
MSohm
Posts: 14,757
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Get mail Status

This returns a bit field that could contain multiple status types.  To check for a specific type you can and it (&) with the contsant and compare to 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
Developer
gxgraham
Posts: 28
Registered: ‎07-16-2008
My Device: Curve 8320

Re: Get mail Status

Hi could you show how you would do this?  ... thanks.
BlackBerry Development Advisor
MSohm
Posts: 14,757
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Get mail Status

You can see an example of this on the last line of code in this sample.

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/How_To_...

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
Developer
gxgraham
Posts: 28
Registered: ‎07-16-2008
My Device: Curve 8320

Re: Get mail Status

I must be missing something.  In my tests I get the following for a message delivered to the device.

 

DEBUG - msg.getStatus() = 2047
 
DEBUG - Message.Status.RX_RECEIVED = 2047
DEBUG - msg.getStatus() & Message.Status.RX_RECEIVED = 2047
 
DEBUG - Message.Status.RX_RECEIVING  = 4095
DEBUG - msg.getStatus() & Message.Status.RX_RECEIVING  = 2047
 
DEBUG - Message.Status.RX_ERROR = 1
DEBUG - msg.getStatus() & Message.Status.RX_ERROR = 1

 

So if these were compared to zero then the messge is not received, not receiving and there is no error ???  I must be reading this wrong.

 

BlackBerry Development Advisor
MSohm
Posts: 14,757
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Get mail Status

The getStatus method actually returns one of the RX or TX values, not a bitmask of combined values (which is where you'd use the & operator).

 

This means you'll need to use a direct comparison (such as an if or switch case) and compare to the constant values.

 

Sorry for the mix up.

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