friends,
i am facing a problem i have phoneContacts list with name and phone numbers in it. i want to copy it in two different static lists so that i can use it to other activities. i am using following code but it displays me last list references in both while retrieving data any one guide me how can i take separate copies of these two objects ?
MyContacts.attackContacts = new ArrayList(phoneContacts);
Collections.copy(MyContacts.attackContacts,phoneContacts);
MyContacts.attackContacts.get(0).setType("attack");
MyContacts.medicalContacts = new ArrayList(phoneContacts);
Collections.copy(MyContacts.medicalContacts,phoneContacts);
MyContacts.medicalContacts.get(0).setType("medical");
System.out.println("attack" + MyContacts.attackContacts.get(0).getType() + " medical " + MyContacts.medicalContacts.get(0).getType());
// result "attack medical" "medical medical"
// it should show independent list results like "attack attack" "medical medical"
any help would be appreciated.