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

Reply
Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

ListField IllegalArgumentException when set row height

Hi ,

 

In my code when I set the height of the list item row using

_listField.setRowHeight(130);

 . when I just add a one item to list it works well but when add another its generate an IllegalArgumentException.

 

Then I removed the above code line , then no exception but my list rows are not completely visible(my list row consist of multi line texts and an image)

 

Can anyone help?

 

Thank you in advance.

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ListField IllegalArgumentException when set row height

does the exception have any detail message?
----------------------------------------------------------
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
Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

Re: ListField IllegalArgumentException when set row height

Unfortunately No

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ListField IllegalArgumentException when set row height

try to add an exception breakpoint for illegalstateexceptions in eclipse. (remove it after testing, there are a lot during simulator start)

where do you call the code above? directly after the constructor of the listfield?
----------------------------------------------------------
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
Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

Re: ListField IllegalArgumentException when set row height

Hi simon,


public class MtScreen extends MainScreen{

public MtScreen() { // TODO Auto-generated constructor stub //change manger background to white getMainManager().setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); _listElements = new Vector(); _listField = new ListField(); _listField.setRowHeight(130); ListCallback _callback = new ListCallback(); _listField.setCallback(_callback); add(_listField); initializeList(); }
...... 

 above is part of my code

Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

Re: ListField IllegalArgumentException when set row height

Hi Simon , I did what you asked , following is the output,... But I can not find anyclue!Capture.PNG

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ListField IllegalArgumentException when set row height

looks fine so far. any success with the debugger?

can you post a snippet of where you add your elements to the field?
----------------------------------------------------------
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
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ListField IllegalArgumentException when set row height

didn't see your post yesterday.
the exception you have there is from the messaging app, it is not the one you are looking for (*jedi-handwave*)
----------------------------------------------------------
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
Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

Re: ListField IllegalArgumentException when set row height

Hi simon,

 

what I did is I attached the debuger to running simulator , then I found 

 

ListItemDataObject item = (ListItemDataObject)_listElements.elementAt(index);// get the data to populate the 
	    	 
g.drawBitmap(10, y, Display.getWidth()-30,item.getImage().getHeight(),item.getImage(), 0, y);// draw the first image HERE I AM GETTING THE EXCEPTION

 any idea?

 

Many thanks in advance

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ListField IllegalArgumentException when set row height

drawBitmap(int x, int y, int width, int height, Bitmap bitmap, int left, int top)

why do you use y for top? usually 0 is used for this parameter.
is the width really displaywidth-30?
is item.getImage() a bitmap?

i would suggest that you remove the line. if it works add some analysis code and a breakpoint.
----------------------------------------------------------
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