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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Developer
Posts: 33
Registered: ‎07-16-2008
My Device: bold
Accepted Solution

Add and Remove Folder Listner to store

I developing an application with Folderlistner api.. i can get all mails from my store i got 2 problems in my application

 

I cant quit folderlistner. am using

removelistner method while calling exit (system.exit) after tat my application processing all emails for example my application deleting all emails from my store. how to remove folderlistner from store 

 

 when restart my application it processing emails once again i mean 2 listners working in same time not only 2

 For every restart another one listner shoud added 

 

 how can i solve this problems? 

 

 to adding listner 

mystore= session.getStore(); mystore.addFolderListener(this);

 

to removeing llistner while calling system.exit(0) 

 

mystore.removeFolderListener(this); mystore=null;

 

 

 


 

Developer
Posts: 213
Registered: ‎07-18-2008
My Device: Not Specified

Re: Add and Remove Folder Listner to store

take a look at this article which exactly does what you are looking for:

 

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

 

 

regards,

 

yosoh 

--------------------------------------------------
problemSolved() ? kudosPlease():kudosPlease();
New Developer
Posts: 33
Registered: ‎07-16-2008
My Device: bold

Re: Add and Remove Folder Listner to store

but my application don have alternate entry points its just a background application with simple ui when user click application icon my application comes foreground how can i get singleten instence
Highlighted
Developer
Posts: 213
Registered: ‎07-18-2008
My Device: Not Specified

Re: Add and Remove Folder Listner to store

To create a singleton instance you dont need an alternate entry point. I was referrring you to this part of the code and not the complete application. Just implement the following part in your application and no need to do alternate entry point settings.

private FolderListenerGUI folderListenerGUI = null;

//Long value: com.samples.folderListener

public static final long RTSID_MY_APP = 0x7451402f595f81a5L;



public FolderListenerApp()

{

try

{

//Get the store from the default instance.

Store store = Session.getDefaultInstance().getStore();

//Add the folder listener to the store.

store.addFolderListener(this);

}

catch (Exception e)

{

System.out.println(e.toString());

}

}



//Returns an instance of the running FolderListenerApp.

public static FolderListenerApp waitForSingleton()

{

//Ensure this is a singleton instance.



//Open the RuntimeStore.

RuntimeStore store = RuntimeStore.getRuntimeStore();

//Obtain the reference of FolderListenerApp.

Object obj = store.get(RTSID_MY_APP);



//If obj is null, there is no current reference

//to FolderListenerApp. Start a new instance

// of FolderListenerApp if one is not running.

if (obj == null)

{

//Store a reference to this instance in the RuntimeStore.

store.put(RTSID_MY_APP, new FolderListenerApp());



return (FolderListenerApp)store.get(RTSID_MY_APP);

} else

{

return (FolderListenerApp)obj;

}

}

 

regards,

 

yosoh

--------------------------------------------------
problemSolved() ? kudosPlease():kudosPlease();
New Developer
Posts: 33
Registered: ‎07-16-2008
My Device: bold

Re: Add and Remove Folder Listner to store

Thank u man got Fixed...