Open mnuuhkar opened 9 years ago
Just add some components to some form and you will see it is acting more or less randomly (the suggested items do not show). When using android you might not be able the select the whole box.
@Override protected void beforeMain(Form f) {
f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
Label labelForFirst = new Label("first:");
TextField first = new TextField();
first.setLabelForComponent(labelForFirst);
Label labelForSecond = new Label("second:");
TextField second = new TextField();
second.setLabelForComponent(labelForSecond);
Label labelForthird = new Label("third:");
TextField third = new TextField();
third.setLabelForComponent(labelForthird);
Label labelForFourth = new Label("fourth:");
TextField fourth = new TextField();
fourth.setLabelForComponent(labelForFourth);
Label labelForFifth = new Label("fifth:");
TextField fifth = new TextField();
fifth.setLabelForComponent(labelForFifth);
Label labelForSixth = new Label("sixth:");
TextField sixth = new TextField();
sixth.setLabelForComponent(labelForSixth);
f.addComponent(labelForFirst);
f.addComponent(first);
f.addComponent(labelForSecond);
f.addComponent(second);
f.addComponent(labelForthird);
f.addComponent(third);
f.addComponent(labelForFourth);
f.addComponent(fourth);
f.addComponent(labelForFifth);
f.addComponent(fifth);
f.addComponent(labelForSixth);
f.addComponent(sixth);
//////////////////////////////
Label labelForPicker = new Label("date:");
Picker picker = new Picker();
picker.setLabelForComponent(labelForPicker);
f.addComponent(labelForPicker);
f.addComponent(picker);
/////////////////////////////
Contact[] contacts = Display.getInstance().getAllContacts(false, false, false, false, true, false);
//////////////////////////////
ArrayList<String> emails = new ArrayList<String>();
for (Contact contact : contacts) {
if(contact.getPrimaryEmail() != null){
emails.add(contact.getPrimaryEmail());
}
}
Label labelForEmails = new Label("emails:");
AutoCompleteTextField emailsField = new AutoCompleteTextField(emails.toArray(new String[emails.size()]));
emailsField.setLabelForComponent(labelForEmails);
f.addComponent(labelForEmails);
f.addComponent(emailsField);
//////////////////////////////
ArrayList<String> emails2 = new ArrayList<String>();
for (Contact contact : contacts) {
if(contact.getDisplayName() != null){
emails2.add(contact.getDisplayName());
}
}
Label labelForEmails2 = new Label("names:");
AutoCompleteTextField emailsField2 = new AutoCompleteTextField(emails2.toArray(new String[emails2.size()]));
emailsField2.setLabelForComponent(labelForEmails2);
f.addComponent(labelForEmails2);
f.addComponent(emailsField2);
}
https://groups.google.com/forum/#!searchin/codenameone-discussions/autocompletetextfield$20not$20re|sort:relevance/codenameone-discussions/gQEuPH9kgsQ/BQTAsOpVUT0J