Note that there are some explanatory texts on larger screens.

plurals
  1. POJ2ME: Crossplatform getting contacs with PIM
    text
    copied!<p>I have to develop solution based on getting data from address book. Those data must be saved into text format. I coded it with Java™ Platform Micro Edition SDK 3.0.</p> <p><code><pre> public void getAddrBook() throws Exception{ addrStr= new StringBuffer(""); pim = PIM.getInstance(); try{ contactList = (ContactList)pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY); itemList.removeAllElements(); int kk=0; for (Enumeration items = contactList.items(); items.hasMoreElements();kk++) { PIMItem item = (PIMItem)items.nextElement(); itemList.addElement(item); if (kk>5) break; //detailed enumeration of fields int[] fields = item.getPIMList().getSupportedFields(); for (int i = 0; i &lt; fields.length; i++) { int field = fields[i]; int dataType = item.getPIMList().getFieldDataType(field); String label = item.getPIMList().getFieldLabel(field); //checking type of PIMItem //can be STRING, BOOLEAN, STRING_ARRAY, DATE, INT, BINARY if (dataType==PIMItem.STRING){ for (int j=0; j <pre><code> } //String sValue = item.getString(field, 0); //System.out.println("["+label+"] - "+sValue); //System.out.println("["+label+"] - ");//+sValue); } } } } catch(PIMException e){ throw new Exception("Some errors with access to address book"); //TODO: check empty list and other } } </code></pre> <p></pre></code></p> <p>But this code works only in emulator and doesn't work in real phone. How should I use PIM for saving data in text format?</p> <p>Also, I allowed access to contact book. I think error is using PIM structure. I need some working sample. Who has it? (:</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload