Code Sample 6 Phonebook Api - Motorola C381P J2ME Technical Manual

J2me developer guide
Table of Contents

Advertisement

11
Phonebook Access API
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

53

Advertisement

Table of Contents
loading

Table of Contents