BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-24-2009, 03:00 AM   #1 (permalink)
New Member
 
Join Date: Jul 2009
Model: 8130
PIN: N/A
Carrier: Mobilink
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up FolderListener is not working in Blackberry 8300

Please Login to Remove!

I am using FolderListener for listening new incoming message but it is not working on Blackberry 8300 although I used signed cod file.I followed the article from Knowledgebase that is:

What Is - Application is not notified when new messages arrive

I am also copy-paste the code that I tried but it is not working:

First Sample:
==========
public class TestEmailListenerEmail implements FolderListener {
public TestEmailListenerEmail()
{
Store store = Session.getDefaultInstance().getStore();
//add the listener
emailListener=new EmailListener(objLI);
store.addFolderListener(emailListener);
}

// rest of code e.g main function etc
}

public class EmailListener implements FolderListener {
public EmailListener()
{
}
public void messagesAdded(FolderEvent e) {
//get the message and folder it was added to
Message orginalMessage = e.getMessage();
Logger.log("Message Arrived with Subject:"+orginalMessage.getSubject())
}

public void messagesRemoved(FolderEvent e) {


}
}


Second Sample:
============
public class TestEmailListenerEmail implements FolderListener {
EmailListener emailListener=new EmailListener();
public TestEmailListenerEmail()
{
Store store = Session.waitForDefaultSession().getStore();
Folder[] folders = store.list();
for( int foldercnt = folders.length - 1; foldercnt >= 0; --foldercnt) {
Folder f = folders[foldercnt];
recurse(f);
}
}
public void recurse(Folder f)
{
if ( f.getType() == Folder.INBOX )
{
f.addFolderListener(emailListener);
}
Folder[] farray = f.list();
for (int fcnt = farray.length - 1; fcnt >= 0; --fcnt)
{
recurse(farray[fcnt]);
}
}
// rest of code e.g main function etc

}

public class EmailListener implements FolderListener {
public EmailListener()
{
}
public void messagesAdded(FolderEvent e) {
//get the message and folder it was added to
Message orginalMessage = e.getMessage();
Logger.log("Message Arrived with Subject:"+orginalMessage.getSubject())
}

public void messagesRemoved(FolderEvent e) {
}
}


Please tell me that what is the thing that I am missing.Please response me as soon as possible.
Offline  
Old 08-07-2009, 12:34 AM   #2 (permalink)
New Member
 
Join Date: Jul 2009
Model: 8130
PIN: N/A
Carrier: Mobilink
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

My Problem is solved
Offline  
Old 08-10-2009, 12:56 AM   #3 (permalink)
Thumbs Must Hurt
 
shraddha294's Avatar
 
Join Date: Oct 2007
Location: Hyderabad
Model: 8800
PIN: N/A
Carrier: TMobile
Posts: 111
Post Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation

Quote:
Originally Posted by Aneela View Post
My Problem is solved
and what was the problem ? The solution will help others with similar problems...
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

SMPTE Output Studio 16 Extras The Complete SMPTE Generator For Your Amiga
$14.99
SMPTE Output Studio 16 Extras The Complete SMPTE Generator For Your Amiga picture23 WAY "D" SHELL HOOD DB23 D23 DB23F DB23M FOR COMMODORE AMIGA CONNECTORS - RARE
$2.54
23 WAY Toshiba TMP68HC000P-16 16mhz 68000 CPU Chip, Amiga Atari Apple Mac
$22.0
Toshiba TMP68HC000P-16 16mhz 68000 CPU Chip, Amiga Atari Apple Mac pictureAMIGA AMIGA A107-335D RQAUS1
$36.1
AMIGA AMIGA A107-335D RQAUS1 pictureCommodore AMIGA CSG 8520 Chip IC 500/A500+/A2000 CDTV - NEW
$12.99
Commodore AMIGA CSG 8520 Chip IC  500/A500+/A2000 CDTV - NEW picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.