Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ListField arrayindex out of bounds exception

 
adroit dhanwada
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i created ListField in blackberry jde.
ListField list=new ListField(4);
if i say :
list.insert(0);
it is giving ArrayIndexOutofBounds exception.iam not calling callback.insert() method also(i commented it).can someone help with this please.is CLDC based applications complex to develop?
Thanks
 
Sayan Jaipan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please try this

ObjectListField olf = ObjectListField() ;
olf.set(new String[]{"1", "2"});
 
adroit dhanwada
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou for the reply.
nope its not working. the error is after calling list.setCallback();,the class implementing the interface ListFieldCallback interface is initialised,then the method :
public void drawListRow(ListField list, Graphics g, int index, int y, int w)
{
String text = (String)listElement.elementAt(index);
g.drawText(text, 0, y, 0, w);
} is being called.
listElement is a java.util.Vector.
here listElement.elementAt(index) is giving ArrayIndexOutOfBoundsException
in the tutorial also the code is exactly like this.
regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic