Welcome!

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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
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!!

Contributor
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
       

           if(checkedFlag){
                      graphics.drawBitmap(...,...,UnCheckedBitmap,...);

                      checkedFlag = false;

                    

           }

           else

                      graphics.drawBitmap(...,...,CheckedBitmap,...);

                      checkedFlag = true;
           }      

}

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

Developer
Posts: 17,026
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:
http://supportforums.blackberry.com/t5/Java-Development/Create-a-ListField-with-check-boxes/ta-p/443...
----------------------------------------------------------
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
Highlighted
Contributor
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!!

 

Regards.