Hi, I believe the problem is that you are trying to delete element using absolute index position. The moment you delete the first element in your loop, the absolute positions for the other elements have changed as a result. This is why the subsequent deletion would fail. If you want to delete all the elements of a blip, you can use the delete() method from TextView.
Hope it helps, Austin On Fri, Oct 16, 2009 at 10:33 AM, Linc <ala...@online.de> wrote: > > I noticed that somehow the loop seems to stops at the point where it > should delete the Image Element: > > else if ( e.getType() == EventType.FORM_BUTTON_CLICKED) { > if (e.getButtonName().equals("button")) { > Blip b = e.getBlip(); > TextView textView = b.getDocument(); > > List<Element> elems = textView.getElements(); > textView.append("Number of Elements: > "+elems.size()+"\n"); > for ( int i=0; i<elems.size(); i++ ){ > textView.append(i+" : "); > int pos = textView.getPosition(elems.get(i)); > textView.deleteElement(pos); > textView.append("Element of Type " + > elems.get(i).getType > () + " deleted.\n"); > } > textView.append("\nDone"); > } > > Output is: > > Number of Elements: 2 > > 0 : Element of Type BUTTON deleted. > 1 : > > Hope somebody knows what's wrong...I would really need that feature > for my project. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~----------~----~----~----~------~----~------~--~---