-1

could anybody help me.I got error java.lang.IndexOutOfBoundsException when i press edit button..

this is my code:

String stredit="";
System.out.println(foodselected.size());
for(int m=0;m<foodselected.size();m++)
{
	if(foodselected.isSelected(m))
	{
		foodselected.delete(m);
		stredit=foodselected.getString(m);
		break;
	}
		
}	
int qtyint=Integer.parseInt(stredit.substring(0,3));
String namestr=stredit.substring(5,stredit.length()-12);
System.out.println(qtyint);
System.out.println(namestr);
namecust.setString(custname.getString());
tableno.setString(txtno.getString());
fooddrinkname.setString(namestr);
txtqty.setString(Integer.toString(qtyint));
frmedit.append(namecust);
frmedit.append(tableno);
frmedit.append(fooddrinkname);
frmedit.append(quantity);
frmedit.append(type);
frmedit.addCommand(ok3);
display.setCurrent(frmedit);
display.setCurrentItem(custname);
Votes + Comments
Waste of time to give you any help, you just want to get solution without closing thread and saying thank you
2
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by lsvife
0

why do i close the thread if some of my threads is not yet solve...

I marked some of my threads as solve...

0

Ok I will take your word on it.
From above code nothing doesn't seems to be wrong. Can you post more of code? Your button handling? Array manipulation?

PS: I would recommend to use Vector as with array it is always size restriction battle

0

it got an error when it read this code

for(int m=0;m<foodselected.size();m++)
{
	if(foodselected.isSelected(m))
	{
		foodselected.delete(m);
		stredit=foodselected.getString(m);//this line is the cause of error..
		break;
	}
		
}

the program run smoothly when i comment it out...
i dont know why??

0

thanks for the help..but i found the solution already...

foodselected is a choicegroup.MULTIPLE
i got an error because delete comes first than retreiving the object...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.