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
New Developer
Posts: 14
Registered: ‎01-12-2012
My Device: Curve 9360
My Carrier: vodacom RSA

File selector popup screen with search

Hi

 

I'm trying to make a file selector popup screen that is able to load all files and has a search editfield at the top which will allow a user to search for whatever file they want instead of going throu all the folders and stuff.

 

Already have a working file selector popup screen but not sure how exactly do i implement the "search" part

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

Re: File selector popup screen with search

I presume you have seen this:

http://supportforums.blackberry.com/t5/Java-Development/Create-a-file-selection-popup-screen/ta-p/44...

 

You will notice that the code following provides a filter based on the extension input - you will just need to extend this filter processing based on the edit field you add:

                                if (currentFile.indexOf(_extensions[count]) != -1)
                                 {
                                      //There was a match, add the file and
                                      //stop looping.

                                      filesVector.addElement((Object)
                                          currentFile);
                                      break;
                                 }

 

You could make this dynamic - by searching every time the user changed the input characters.  To trigger this you would have a FieldChangedListener on the edit field.

 

However I think a Button or the 'enter' key is more user friendly.  You can detect 'enter' by having a KeyListener on the edit Field. 

 

Good luck.

New Developer
Posts: 14
Registered: ‎01-12-2012
My Device: Curve 9360
My Carrier: vodacom RSA

Re: File selector popup screen with search

thanks for the response will try it out and keep you posted