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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Regular Contributor
mohdfarhanakram
Posts: 73
Registered: ‎12-30-2011
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
Please use plain text.
Developer
simon_hain
Posts: 13,830
Registered: ‎07-29-2008
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
Please use plain text.