Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Contact[] getPhoneContacts() {
- if (contacts == null)
- return null;
- int noOfPhoneContacts = 0;
- int phoneContactsIdx = 0;
- for (int i = 0; i < contacts.length; i++)
- if ((contacts[i].getType()).equals("Phone"))
- noOfPhoneContacts++;
- Contact[] phoneContacts = new Contact[noOfPhoneContacts];
- for (int i = 0; i < contacts.length; i++)
- if ((contacts[i].getType()).equals("Phone"))
- phoneContacts[phoneContactsIdx++] = contacts[i];
- return phoneContacts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement