07-22-2008 03:24 AM
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
07-22-2008 05:01 AM
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.
07-22-2008 05:08 AM
int status=mail.getStatus(); if(status==Message.Status.TX_DELIVERED) { mail.getFolder().deleteMessage(mail): }
status retuns some value like 41576834 ?
07-22-2008 11:23 AM
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.
08-26-2008 05:32 PM
08-27-2008 09:12 AM
You can see an example of this on the last line of code in this sample.
08-27-2008 10:09 AM
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.
08-27-2008 11:22 AM
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.