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
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

regarding string

i have two strings

String first = "Teach the children not to receive anything for nothing; let them earn by hardwork the things they seek.";

and i have edit field when i enter any word in edit filed , if that enterd word will exist in my first string that will show the full first string.

for eg. i got the text from edit field and put into String second = "Teach";

if the second string will exist in my first(string) that will display me the whole first string.can u help me 

Please use plain text.
Developer
simon_hain
Posts: 15,853
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: regarding string

maybe http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/ui/component/KeywordFilterFiel...
if this does not fit your needs you would have to implement something similar yourself.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: regarding string

i found that there is no String.Contain() method,in BB. keword filter did not solve my issue. i have 50 thoughts added to my vector and i put them all into string and my string have 50 thoughts,and i have edit field when i enter any word in edit filed , if that enterd word will exist in that string that will show all the strings that contains the edit field text..

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: regarding string

How about String.indexOf(String str)

 

 

Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: regarding string

 i'm new to blackberry can u explain String.indexOf(String str) method to me with an example.

Please use plain text.
Developer
peter_strange
Posts: 19,598
Registered: ‎07-14-2008
My Device: Not Specified

Re: regarding string

There are various SringUtilities methods hat I have found useful in circumstances like this too.

 

Since you have to write this yourself, here are some general instructions:

a) Create a button so that the user can enter the Search field and then press the Button.

b) Create a new VerticalFieldManager

c) On Button Click, search your Vector and for each match, create a LabelField containing the Text.  Add the LabelField to the VerticalFieldManager

d) Add the VerticalFieldManager to the Screen

e) If you have previously done a search, remove associated VerticalFieldManager from the screen. 

 

There are many different ways of achieving similar effects, but get this one working first and then you decide if you like it.. 

Please use plain text.
Developer
simon_hain
Posts: 15,853
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: regarding string


Achin wrote:

 i'm new to blackberry can u explain String.indexOf(String str) method to me with an example.


If you are new it should be extra important to get to know the API documentation:

http://www.blackberry.com/developers/docs/7.1.0api/java/lang/String.html#indexOf(java.lang.String)

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.