Friday, October 9, 2015

Re: uncaught java.lang.indexoutofboundsexception

I already expected my error and it worked fine by removing the = operator.

but unfortunately when I wanted to add the real code expected to be run within the for loop, I have had the same exception, and I also had only 1 displayed item in 2 (so that if I have 10 items, it display only 5 by skeeping every time 1 item), here is the code
              

              for(int i=0; i<nbMenuItems; i++){
MaterialToast.alert("ok"+ subMenuItemsContainer.getWidget(i));
MaterialRow row = new MaterialRow();
MaterialColumn col1=new MaterialColumn( 12, 6, 3);
col1.add(subMenuItemsContainer.getWidget(i));
row.add(col1);
mosaiqueContainer.add(row);
}
}

I really don't understand what is the wrong with my code ???



Le vendredi 9 octobre 2015 11:54:40 UTC+2, Frank a écrit :
replace for(int i=0; i<=nbMenuItems;i++)
by for(int i=0; i<nbMenuItems;i++)

Op vrijdag 9 oktober 2015 11:34:32 UTC+2 schreef NewbieGwtUser:
Hello,

I have a global view in which I have to display a table that its rows depend on the number of lateral submenu Items called 'subMenuItemsContainer'.

I create this method where I just want to show if I get the good item values or not and I call it within the view constructor after the initWidget(uiBinder.createAndBindUi(this)) instruction :

        



public void fillContainer(){
int nbMenuItems = subMenuItemsContainer.getWidgetCount();
for(int i=0; i<=nbMenuItems;i++){
MaterialToast.alert(""+ subMenuItemsContainer.getWidget(i));
}



but when I run the application, I got an empty screen with just displayed toast.


and the uncaught java.lang.indexoutofboundsexception when I open the chrome tool Developer, have you an idea what's wrong with my loop that I even tried to replace with while loop, but I have the same problem.

any idea about what mistake have I commited ???

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment