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

2-Keystone Ballast KTEB432UVISNP T8 Electronic Ballast NEW lot-t8
$6.0
2-Keystone Ballast KTEB432UVISNP T8 Electronic Ballast NEW lot-t8 picturePOWER SELECT PS30U62L BALLAST *NEW NO BOX*
$28.0
POWER SELECT PS30U62L BALLAST *NEW NO BOX* pictureFulham Workhorse 2 Electronic Ballast Instant Start 120V P/N WH2-120-L
$5.0
Fulham Workhorse 2 Electronic Ballast Instant Start 120V  P/N WH2-120-L pictureSYLVANIA QTP4X54T5HO/UNV PSN HT W FLUORESCENT BALLAST, 4 LAMP 54W T5HO, 120/277V
$26.78
SYLVANIA QTP4X54T5HO/UNV PSN HT W FLUORESCENT BALLAST, 4 LAMP 54W T5HO, 120/277V picturePhilips Advance Optanium IOP-2P59-SC Fluorescent Ballast SEALED
$23.8
Philips Advance Optanium IOP-2P59-SC Fluorescent Ballast  SEALED picture






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