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: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Delete All Mails

 

 

Recursively means the thread should continuously run all the time ?

 

Thanks...

Developer
Posts: 304
Registered: ‎08-01-2008
My Device: Not Specified

Re: Delete All Mails

No recursively means, search for folders within folders.

 

 

public void deleteAllMailsInFolders(Folder[] folders) { for(int i=0; i<folders.length; i++) { Folder f = folders[i]; //Delete mails in this folder //Check if this folder has any subfolders Folder[] subfolders = f.list(); deleteAllMailsInFolders(subfolders); } }

 

And call the above method using 

 

 

deleteAllMailsInFolders(store.list());

 

 

 

 

 

 

Developer
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Delete All Mails

The application is not on the BES it is installed on my device...

 

 

 

Thanks...

Developer
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Delete All Mails

Yes I was calling the delete Mails on MenuItem.

 

If my application is not on BES then the code which I have pasted should work... Or do i need to use recursive call

 

 

 

Thanks...

Developer
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Delete All Mails

I tried to call delete Mails in seperate Thread and also tried to recursively traverse through all subfolders and delete the mails in that.

 

I attached the debugger also. The code goes through all the subfolders. But the number of messages in all the folders printed are 0.

 

It is working properly on the Simulator, I am managing to delete all the Emails in the mail box i.e Inbox, Outbox, Sent and Drafts. 

 

Any suggestion how can I make it work on the Device. I am using Blackberry Bold 9000 4.6.162.

 

Thanks...

Developer
Posts: 304
Registered: ‎08-01-2008
My Device: Not Specified

Re: Delete All Mails

Probably you have multiple service books and the default mail store does not have any mails. You need to call your delete method for all stores present on the device.
Developer
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Delete All Mails

Hi,

 

 How can you get all the stores in the device... Please can you provide a snippet for that..

 

 

 

Thanks.....

Developer
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Delete All Mails

[ Edited ]
will try to retrieve all the stores and check it out....

Message Edited by safycool on 06-02-2009 01:14 AM
Highlighted
Developer
Posts: 304
Registered: ‎08-01-2008
My Device: Not Specified

Re: Delete All Mails

just make sure you put the code within the loop in a try catch block. This way if there are some invalid service records, they would not stop the loop from executing.