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
Regular Contributor
Posts: 73
Registered: ‎12-30-2011
My Device: All devices
My Carrier: RIM

Device restart automaticaly !!! Problem

[ Edited ]

Hi every one when i append a message to folder by code, my device is restarted automaticaly , i dont know how it happend my code is .

 

public void messagesAdded(FolderEvent e) {
        
        if( e.getMessage().isInbound() == true ){
            Message msg = e.getMessage();
            boolean f = (msg.getFolder()).deleteMessage(msg);
            
            Session session = Session.waitForDefaultSession();  
            Store store = session.getStore();  
            Folder[] folders = store.list(Folder.DRAFT);  
            Folder draft = folders[0];
            draft.appendMessage(msg);

|

 

Thanks

Mohd Farhan
Highlighted
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Device restart automaticaly !!! Problem

waitForDefaultSession() is a blocking call, it should not be executed from the event thread.
but why the device would restart i have no clue, check the event logs (alt+lglg) maybe.
----------------------------------------------------------
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