
13
Phonebook Access
Sample of code for calling of ‘resetPrimary(int index, int sortOrder)’ method:
int index = 1;
PhoneBookRecord.resetPrimary(index, PhoneBookRecord.SORT_BY_NAME);
Sample of code for calling of ‘isPrimary(int speedNo)’ method:
int speedNo = 1;
boolean res = PhoneBookRecord.isPrimary(speedNo);
Sample of code for calling of ‘fromVFormat(InputStream in, int device)’ method:
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()));
Sample of code for calling of ‘createMailingList(int[] members, int sortOrder)’ method:
PhoneBookRecord mailingList = new PhoneBookRecord(); int mlSpeedNumbers[] = new int[2]; mlSpeedNumbers[0] = 1;
mlSpeedNumbers[1] = 2; mailingList.name = “MList”; mailingList.type = PhoneBookRecord.MAILING_LIST; mailingList.speedNo =
PhoneBookRecord.getNewSpeedNo(1, PhoneBookRecord.PHONE_MEMORY);
index = mailingList.createMailingList(mlSpeedNumbers, PhoneBookRecord.SORT_BY_NAME);
Sample of code for calling of ‘addMailingListMember(int mlSpeedNo, int mbSpeedNo)’ method:
int mlspeedNo = 3, mbspeedNo = 4;
PhoneBookRecord.addMailingListMember(mlspeedNo, mbspeedNo);
Sample of code for calling of ‘deleteMailingListMember(int mlSpeedNo, int mbSpeedNo)’ method:
73