Motorola HANDSET C381P User Manual

Page 53

Advertising
background image

11
Phonebook
Access API

53

buffer = new String("BEGIN:VCARD\r\nN:;" + new String(name) +

"\r\nTEL;TYPE=WORK:1\r\nEND:VCARD\r\n");

int num =

PhoneBookRecord.fromVFormat((InputStream)(new
ByteArrayInputStream(buffer.getBytes())),

PhoneBookRecord.PHONE_MEMORY);

Sample of code for calling of ‘toVFormat(OutputStream out, int
index, int outFormat, int sortOrder)’ method:

int index = 1;

ByteArrayOutputStream outStream = new ByteArrayOutputStream();

PhoneBookRecord.toVFormat(outStream, index,
PhoneBookRecord.VCARD_3_0,

PhoneBookRecord.SORT_BY_NAME);

System.out.println("***** Contents of the output stream: *****");

System.out.print(new String(outStream.toByteArray()));

Code Sample 6 Phonebook API

Advertising