Skip to main content

PIM problem

5 replies [Last post]
Anonymous

I'm trying to get names and phone numbers from the phone but I'm having problems doing this on the Nokia N70. It recognises the fields like name and number but only shows values for phone number. It throws a IllegalArgumentException: Invalid attribute: 0 when trying to contact.countValues(fieldIndex); on phone number. Where am i going wrong here?

try{
PIM pim = PIM.getInstance();
ContactList clist=null;
try {
clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY );
} catch(Exception e) {
sb.append("{"+e+"}");
}

Contact contact = null;
Enumeration items = clist.items();
while(items.hasMoreElements()) {

contact = (Contact)(items.nextElement());
int[] fields = contact.getFields();
for(int i = 0; i < fields.length; i++) {
int fieldIndex = fields[i];
int dataType = clist.getFieldDataType(fieldIndex);

sb.append(" Field " + fieldIndex + ": "+ clist.getFieldLabel(fieldIndex)+" - data type: " + dataType);
sb.append("\n");

for(int j = 0; j < contact.countValues(fieldIndex); j++) {
int attr = contact.getAttributes(fieldIndex, j);

try{

sb.append("("+clist.getAttributeLabel(attr) + "): ");
sb.append(contact.getString(fieldIndex, j));
sb.append("\n");
}catch(Exception e){
sb.append(":"+e+":");
sb.append("\n");
}

}

}
}

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Stefan Haustein

Hi,

I am not able to access the Camera on the Motorola Razr V3i, although
"JSR 135 - Still Image Capture" is explicitly listed in the supported
features list available at

http://developer.motorola.com/products/handsets/motorazrv3i/

Of course, our test application works fine on other phones with JSR 135
camera support. I tried both, "capture://video" and "capture://camera"
(as specified in the MOTORAZR V3i Developer Guide), but I always get a
MediaException ("createPlayer() failed").

Can anybody confirm that JSR 135 camera snapshots are actually supported
for this device? Is there anything special one needs to consider when
working with the Camera on Motorola phones (We do not have any problems
with the E1000)?

Best regards,
Stefan

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

unclejims
Offline
Joined: 2007-10-29
Points: 0

Hi There,
This is just a long shot, but i'm wondering if you had any luck with video capture on the Razr V3i? If so, please let me know.

Appreciate it!
Jims

ajay_kumar
Offline
Joined: 2008-06-26
Points: 0

hi plz help me
i am storing phone number and name from j2me application into addressBook.it is working prfectly on sun emulator
but
when i install on My Nokia N72.it retrive all contact but at the time of storing it throws SecurityException.
plz help me to solve this problem.
or there is any other way to store contact in addressBook.

C. Enrique Ortiz

Are you sure it happened at method countValues()?

... vs. it happening at method call getAttribute()? or even at
getAttributeLabel(...)?

To make sure are supported fields and attributes are really supported on
a specified impl, always do:

* Before accessing attributes call isSupportedAttribute(...)
* Before accessing fields call isSupportedField(...)

ceo

Chris B wrote:
> I'm trying to get names and phone numbers from the phone but I'm
> having problems doing this on the Nokia N70. It recognises the fields
> like name and number but only shows values for phone number. It throws
> a IllegalArgumentException: Invalid attribute: 0 when trying to
> contact.countValues(fieldIndex); on phone number. Where am i going
> wrong here?
>
> try{
> PIM pim = PIM.getInstance();
> ContactList clist=null;
> try {
> clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST,
> PIM.READ_ONLY );
> } catch(Exception e) {
> sb.append("{"+e+"}");
> }
>
>
> Contact contact = null;
> Enumeration items = clist.items();
> while(items.hasMoreElements()) {
>
> contact = (Contact)(items.nextElement());
> int[] fields = contact.getFields();
> for(int i = 0; i < fields.length; i++) {
> int fieldIndex = fields[i];
> int dataType = clist.getFieldDataType(fieldIndex);
>
> sb.append(" Field " + fieldIndex + ": "+
> clist.getFieldLabel(fieldIndex)+" - data type: " + dataType);
> sb.append("\n");
>
> for(int j = 0; j < contact.countValues(fieldIndex); j++) {
> int attr = contact.getAttributes(fieldIndex, j);
>
> try{
>
> sb.append("("+clist.getAttributeLabel(attr) + "): ");
> sb.append(contact.getString(fieldIndex, j));
> sb.append("\n");
> }catch(Exception e){
> sb.append(":"+e+":");
> sb.append("\n");
> }
>
> }
>
>
> }
> }
>
> --------------------------------
>
>
> Spam/Virus scanning by CanIt Pro
>
> For more information see http://www.kgbinternet.com/SpamFilter.htm
>
> To control your spam filter, log in at http://filter.kgbinternet.com
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body of the message "signoff KVM-INTEREST". For general help, send
> email to listserv@java.sun.com and include in the body of the message
> "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Chris B

Cheers, it was clist.getAttributeLabel(attr) - i just caught that in another try catch
----- Original Message -----
From: C. Enrique Ortiz
To: KVM-INTEREST@JAVA.SUN.COM
Sent: Monday, February 05, 2007 1:58 PM
Subject: Re: PIM problem

Are you sure it happened at method countValues()?

... vs. it happening at method call getAttribute()? or even at getAttributeLabel(...)?

To make sure are supported fields and attributes are really supported on a specified impl, always do:

* Before accessing attributes call isSupportedAttribute(...)
* Before accessing fields call isSupportedField(...)

ceo

Chris B wrote:
I'm trying to get names and phone numbers from the phone but I'm having problems doing this on the Nokia N70. It recognises the fields like name and number but only shows values for phone number. It throws a IllegalArgumentException: Invalid attribute: 0 when trying to contact.countValues(fieldIndex); on phone number. Where am i going wrong here?

try{
PIM pim = PIM.getInstance();
ContactList clist=null;
try {
clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY );
} catch(Exception e) {
sb.append("{"+e+"}");
}

Contact contact = null;
Enumeration items = clist.items();
while(items.hasMoreElements()) {

contact = (Contact)(items.nextElement());
int[] fields = contact.getFields();
for(int i = 0; i < fields.length; i++) {
int fieldIndex = fields[i];
int dataType = clist.getFieldDataType(fieldIndex);

sb.append(" Field " + fieldIndex + ": "+ clist.getFieldLabel(fieldIndex)+" - data type: " + dataType);
sb.append("\n");

for(int j = 0; j < contact.countValues(fieldIndex); j++) {
int attr = contact.getAttributes(fieldIndex, j);

try{

sb.append("("+clist.getAttributeLabel(attr) + "): ");
sb.append(contact.getString(fieldIndex, j));
sb.append("\n");
}catch(Exception e){
sb.append(":"+e+":");
sb.append("\n");
}

}

}
}
--------------------------------

Spam/Virus scanning by CanIt Pro
For more information see http://www.kgbinternet.com/SpamFilter.htm

To control your spam filter, log in at http://filter.kgbinternet.com

=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff KVM-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff KVM-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]