Note that there are some explanatory texts on larger screens.

plurals
  1. POBlackberry ObjectChoiceField Not Showing drop down list
    text
    copied!<p>ObjectChoiceField not working because the below code: </p> <pre class="lang-java prettyprint-override"><code>protected boolean navigationUnclick(int status, int time) { return true; } </code></pre> <p>I have added this code to remove the menus on touchevent. Means I have made a custom bottom tab and adding and deleting verticalfields on screen. When i touch any HorizontalField it shows menu that's why i added the above code.</p> <p>This is my code contains <code>ObjectChoiceField</code> added in horizontalfield:</p> <pre class="lang-java prettyprint-override"><code>import net.rim.device.api.system.Bitmap; import net.rim.device.api.system.EncodedImage; import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.FieldChangeListener; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.TouchEvent; import net.rim.device.api.ui.component.BitmapField; import net.rim.device.api.ui.component.ButtonField; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.component.ObjectChoiceField; import net.rim.device.api.ui.container.VerticalFieldManager; import com.ec.pleasewaitpopup.PleaseWaitPopupScreen; import com.np.naijapings.ApplicationFont; import com.np.naijapings.Constant; import com.np.naijapings.TabControlScreen; import com.np.naijapings.intermediateclasses.GetUserListIntermediator; import com.tv.servercommunication.WebServiceDetails; public class FindUsersScreen extends VerticalFieldManager implements FieldChangeListener{ private VerticalFieldManager _mainVfm; private VerticalFieldManager _contentVfm; private BitmapField _headerBmp; private EncodedImage _bitmap; private LabelField _gender; private LabelField _age; private LabelField _religion; private ObjectChoiceField _genderChoiceField; private ObjectChoiceField _ageChoiceField; private ObjectChoiceField _religionChoiceField; private ButtonField _findUser; private static String[] _genderChoices={"Both gender","Male","Female"}; private static String[] _ageChoices={"Any age","18-25","26-30","31-35","36-45","46-50"}; private String[] _religionChoices={"Any religion","Hindu","Muslim"}; public FindUsersScreen(){ //HEADER IMG _bitmap = EncodedImage. getEncodedImageResource("find-user_header.png"); _headerBmp = new BitmapField(Constant.sizePic(_bitmap, _bitmap.getHeight(), _bitmap.getWidth())); //MAIN VFM _mainVfm=new VerticalFieldManager(); //CONTENT VFM final Bitmap tabBackGroundImage = Bitmap .getBitmapResource("finduserscr_bg.png"); _contentVfm=new VerticalFieldManager(){ protected void paint(Graphics graphics) { int y = FindUsersScreen.this.getManager().getVerticalScroll(); graphics.drawBitmap( 0, y, tabBackGroundImage.getWidth(), tabBackGroundImage.getHeight(), tabBackGroundImage, 0, 0 ); super.paint( graphics ); } }; //CREATE WIDGETS _gender=new LabelField("Gender"); _genderChoiceField=new ObjectChoiceField("Gender", _genderChoices,0){ protected boolean touchEvent(TouchEvent message) { return super.touchEvent(message); } }; _age=new LabelField("Age"); _ageChoiceField=new ObjectChoiceField("Age", _ageChoices,0); _religion=new LabelField("Religion"); _religionChoiceField=new ObjectChoiceField("Religion", _religionChoices,0); _findUser=new ButtonField(" Find Users ",ButtonField.CONSUME_CLICK); _findUser.setChangeListener(this); //SET FONT TYPE /*_gender.setFont(ApplicationFont.labelFont_16); _genderChoiceField.setFont(ApplicationFont.labelFont_16); _ageChoiceField.setFont(ApplicationFont.labelFont_16); _age.setFont(ApplicationFont.labelFont_20); _religionChoiceField.setFont(ApplicationFont.labelFont_20); _religion.setFont(ApplicationFont.labelFont_20); */ //SET MARGIN /*_gender.setMargin(5,20,5,20); _age.setMargin(5,20,5,20); _religion.setMargin(5,20,5,20); */ _contentVfm.setMargin(15,30,15,0); _genderChoiceField.setMargin(10,5,5,5); _religionChoiceField.setMargin(10,5,5,5); _ageChoiceField.setMargin(10,5,5,5); _findUser.setMargin(10,80,20,80); _contentVfm.setMargin(30,10,30,10); //ADD FIELDS TO CONTENT VFM //_contentVfm.add(_gender); _contentVfm.add(_genderChoiceField); //_contentVfm.add(_age); _contentVfm.add(_ageChoiceField); //_contentVfm.add(_religion); _contentVfm.add(_religionChoiceField); _contentVfm.add(_findUser); _mainVfm.add(_headerBmp); _mainVfm.add(_contentVfm); add(_mainVfm); } public void fieldChanged(Field field, int context) { if(field==_findUser){ Object obAgeRange = _ageChoiceField.getChoice(_ageChoiceField.getSelectedIndex()); String ageRange = obAgeRange.toString(); Object obgender = _genderChoiceField.getChoice(_genderChoiceField.getSelectedIndex()); String gender = obgender.toString(); Object obReligion = _religionChoiceField.getChoice(_religionChoiceField.getSelectedIndex()); String religion = obReligion.toString(); GetUserListIntermediator getUserListIntermediator=new GetUserListIntermediator(ageRange,gender,religion); PleaseWaitPopupScreen.showScreenAndWait(getUserListIntermediator, Constant.PLEASE_WAIT_TEXT); } } } </code></pre> <p>could anyone answer me how to solve this problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload