This is simpler:

while( Name.size() > 0 ) {
  Name.remove(0);
}

On Dec 6, 3:59 pm, Kevin Anthony <[email protected]> wrote:
> i have a List<String declared like this:
> private static List<String> Name = new ArrayList<String>();
> private static List<String> Number = new ArrayList<String>();
> private static List<String> Address = new ArrayList<String>();
> private static List<String> Email = new ArrayList<String>();
>
> and i'm trying to loop threw and delete them when a user longclicks on
> them and clicks delete
> here's the delete code:
>
> public void deleteName(long id){
>                 String name = Name.get((int)id);
>                 for (int i = 0; i < Name.size();i++) {
>                         if (Name.get(i)== name){
>                                 Name.remove(i);
>                                 Number.remove(i);
>                                 Address.remove(i);
>                                 Email.remove(i);
>                         }
>                 }
>                 return;
>         }
>
> however, it only deletes the entry you click on, not all entries, i've
> done some log outputting and the Entries all look the same to my eye,
> even capilization.
>
> What am i doing wrong?
>
> Thanks
> Kevin A

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to