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

Posts: 10
Registered: ‎01-16-2013
My Device: BB7 and BB10
My Carrier: Airtel

ObjectChoiceField/list on click of image

Hello folks,


I am developing an app on BB7.1 on java.


I am trying to get a dropdown list on click of image.


I even went through the post:




This is not working for me.



My Code;


Bitmap bitmapImage = Bitmap.getBitmapResource("system-star-icon.png");
        BitmapField fieldDemo = new BitmapField(bitmapImage);
        fieldDemo.setMargin(2, 5, 5, 0);


        final ObjectChoiceField starSort=new ObjectChoiceField("",starRating){
        protected void fieldChangeNotify(int context) {
        // TODO Auto-generated method stub
                int selectedIndex=getSelectedIndex();
                Collections.insertionSort(hoteldetails, new StarHigherComparator());
//                HotelListingLoop.SELECTED_DAY=1;
                HotelListingLoop hotelchange=new HotelListingLoop(hoteldetails, HotelListingScreen.this);
                else if(selectedIndex==2){
                    Collections.insertionSort(hoteldetails, new StarComparator());
                    HotelListingLoop hotelchange=new HotelListingLoop(hoteldetails, HotelListingScreen.this);

        protected void paint(Graphics graphics) {
            protected void layout(int width, int height) {
                // TODO Auto-generated method stub
                super.layout(Display.getWidth()/4, getHeight());


fieldDemo = new BitmapField(bitmapImage, ButtonField.CONSUME_CLICK
                | ButtonField.FOCUSABLE) {
            protected boolean navigationClick(int status, int time) {
                // Dialog.alert("refresh!");
                return true;






Can somebody please suggest me how to achieve this. I am missing something out here.


Basically on click of image i need a list to be displayed.



Thanks in advance.