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: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: listening incoming mails

Wrap a try ... catch around your e.getMessage().getFrom()

 

The getFrom() throws an Exception.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Regular Contributor
Posts: 77
Registered: ‎02-17-2010
My Device: Not Specified

Re: listening incoming mails

ya i did lik that only... 

now not getting exception........... but application is struct ..

when ever it receives new mail,application is structed

 i need to restart handset  every time 

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: listening incoming mails

I suspect a lot of the problems you are having are related to the fact that you are attempting to process a message in a listener, that is not actually running in your own process.  This has a number of impacts, for example access to shared static variables and the User through the UI. 

 

So instead I suggest you use the much safer mechanism of only having your listener forward the information to your Application using a Global Event, then your applicatin can deal with it and manage the UI interaction without screwing up the email processing on the device. 

 

Here is a KB article that talks about Global Events.

 

What Is - Global Events and Global Event Listeners
Article Number: DB-00145
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/What_Is...

 

BTW I have no idea what this means:

"when ever it receives new mail,application is structed"

Regular Contributor
Posts: 77
Registered: ‎02-17-2010
My Device: Not Specified

Re: listening incoming mails

[ Edited ]

hi all,

 

thanks for the reply....

now the application is working fine...

but on exiting the application,the listener continues to listen incoming mails.

does anyone knows how to stop listening ?

i overrided the OnClose() method.

 

{

System.Exit(0);

}

 

i used this code for listening mails and updating foreground ..

 

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

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: listening incoming mails

You have to remove the listener using:

 

 

removeFolderLister();

 

 

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Regular Contributor
Posts: 77
Registered: ‎02-17-2010
My Device: Not Specified

Re: listening incoming mails

hi..

 

i tried that removeFolderListener..but not working ..still it will listen incoming mails.

can u please guide me where excatly i can place that to work properly ?