Skip to main content

Autocompletion in J2ME

4 replies [Last post]
johnpl
Offline
Joined: 2007-11-21

Hello

i'm looking for a simple example for autocompletition, I want to storage the strings in an array for testing. Maybe someone can help me?

thx
johnpl

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
terrencebarr
Offline
Joined: 2004-03-04

Ah, ok. I am not aware of an example of that ... but it may exist.

Basically, MIDP doesn't support keypress callbacks once the cursor is in a TextBox or similar Item. So really you would write a CustomItem which implements your own AutocompletionTextBox and listens to the keypresses in the Canvas. You can use the Mobile Ajax project https://meapplicationdevelopers.dev.java.net/mobileajax.html to access web services that provide you with keyword data that you then compare against the keys the user is pressing in your AutocompletionTextBox.

Hope this helps,

-- Terrence

terrencebarr
Offline
Joined: 2004-03-04

What do you mean by 'autocompletion'?

-- Terrence

johnpl
Offline
Joined: 2007-11-21

...hmm something like google suggest or similiar WEB 2.0 sites.

just a textfield witch suggest some words, depending on the chars witch were insert by the user. This should be no request to an server, the "database" in this case, is just an string array or something like this..

( sry for my english ;) )

kyank
Offline
Joined: 2006-05-01

If you're willing to do some digging, the current 2.0 Preview version of J2ME Polish (http://www.j2mepolish.org/mobile/j2mepolish-2.0-Preview.jar) includes an almost-undocumented predictive text framework. See the class de.enough.polish.ui.PredictiveAccess as a starting point.