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);
peter_budo commented: Waste of time to give you any help, you just want to get solution without closing thread and saying thank you -4

Recommended Answers

All 8 Replies

Waste of time to give you any help, you just want to get solution without closing thread and saying thank you

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

I marked some of my threads as solve...

ok sorry...
it will not happen again..

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

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??

thnks for the help...appreciate it...

Please post rest of the code. I cannot work out what "foodselected" object type it is.

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.