07-28-2010 07:48 AM - edited 07-28-2010 07:49 AM
Hi Everyone
I need to remove the ADDRESS field from the BlackBerry contact, can any one suggest me how to do this? I tried the following thing, but it gives me FieldFullException.
if(contact.countValues(Contact.ADDR)>0)
{
for(int i = 0; i < contact.countValues(Contact.ADDR); i++)
contact.removeValue(Contact.ADDR,i);
}
It'll be really helpful if you can provide some information.
thanks n regards
Abhishek
07-28-2010 08:14 AM
instead of trying to remove the address value, try setting it to null.
Let me know if that works.
07-28-2010 08:28 AM
Do u maen to say that while fetching data from contacts u dont want to fetch address field data???????
07-28-2010 08:39 AM
it is always a bad idea to iterate over something and change it in the same iteration.
07-29-2010 01:52 AM
Hi swati,
i had fetched a blackberry contact and now i want to remove each and every field of it. I successfully removed all other fields except the ADDRESS and NOTE fields. i want a solution to remove them. Pls see the code snippet attached with the privious post.
regards
Abhishek
07-29-2010 01:55 AM
Hi Simon,
i'm not iterating over something, i'm having a full contact already with me. I just want to remove each n every field of it.
please provide me if you have some solution.
regards
Abhishek
07-29-2010 03:20 AM
abhishek_puppalwar wrote:
Hi Everyone
I need to remove the ADDRESS field from the BlackBerry contact, can any one suggest me how to do this? I tried the following thing, but it gives me FieldFullException.
if(contact.countValues(Contact.ADDR)>0)
{
for(int i = 0; i < contact.countValues(Contact.ADDR); i++)
contact.removeValue(Contact.ADDR,i);
}
It'll be really helpful if you can provide some information.
thanks n regards
Abhishek
lets say the contact has 2 values.
first run:
i = 0. <2? true. delete the one at 0. contact has now only 1 value left.
i = 1. <1? false
this means you are removing all but one.
(i have not checked the functionality of the code, only hinting at the logic)
07-29-2010 03:55 AM
hey buddy,
can u tell me how to use 'contact.setString(int,int.int.String)' and contact.setStringArray(int,int,int,String[])
regards
Abhishek