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: 18
Registered: ‎03-02-2012
My Device: BlackBerry 9300
My Carrier: Yoigo
Accepted Solution

Problem with ListField

Hi everyone,


when user click in a ListField i want to update an image of a row but i didn't get it. 


My purpose is simulate a checkbox, it means that by default in the end of the row there is an unchecked image and when user click there is a checked image.

I tried to overwrite drawListRow of ListFieldCallback but i don't know how update the row when user click to change the unchecked image with the checked image.


Any help is welcome, thanks very much!!

Posts: 24
Registered: ‎01-24-2011
My Device: 4.2.1(8800), 4.6(9000), 4.7 and above

Re: Problem with ListField


Inside drawListRow() use the Graphics and ListField object and do the following:


static boolean boolean checkedflag = false;

  void drawListRow(ListField listField, Graphics graphics, int index, int y, int width){


  if (listField.getSelectedIndex() != -1)) {  //i.e a row gets selected


                      checkedFlag = false;





                      checkedFlag = true;


The above code may require some fine tuning!...but graphics.drawBitmap() will work just fine.

Posts: 17,003
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Problem with ListField

welcome to the support forums.

you can find the appropriate sample by using the search box on the top right of the screen.

here is the link:
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
Posts: 18
Registered: ‎03-02-2012
My Device: BlackBerry 9300
My Carrier: Yoigo

Re: Problem with ListField

Thanks very much to both.

Simon, I had already looked the example but i ddidn´t see the most important line: invalidate()  

This call repaint the selected row Smiley Happy


Dsheel, geSelectedIndex() isn't a good condition because when focus is on row, this return true and I only want to change the image when row is pressed. So it is necessary create a class like the example class, ChecklistData.


To sum up, apologize for my english and thanks veye much!!