I want some Nokia Champ or Pro Developer to answer my Question as I have already been given so many suggestions and solutions but none of them worked. I have designed a j2me application which reads contacts from SIM and Phone memory after selecting options (From Sim, From Phone) individually. I have problems in here which I think are from the Nokia Devices as I tried that over almost 30 to 50 mobile sets.
Problem is defined here
1- When reading contacts either from SIM or Phone for the very first time of the application is installed/Downloaded/Put into the phone, when I try to read contacts the application hangs there no matter how long I wait it doesn't work, and when I restart the application, it works fine. Now I want to ask whether this issue is genuinely in Nokia devices? because I tried to put even simplest lines of code to read contacts but on the very first time it always hang. Point to note that my application is signed from VeriSign and if run without certificate it works fine as it doesn't ask me for "Always" permission. So what I concluded is that when I select always permissions, it either unable to set those permissions at the first time or what else? I am posting the simplest code I used as I was suggested by some Nokia Developer to put code in Thread so did I but the same issue persists, and it actually messing up my development of the application. I need to resolve this issue at any cost. Here is the code
---of course I have this code modified according to my needs, but even if I use it's simplest form(just reading part) it still behaves like that, so don't ask me to put that code as you can understand what I mean, thanks---Code:public void ReadContacts extends Thread{ public void run(){ try { boolean doWrite = true; contacts.removeAllElements(); pim = PIM.getInstance(); String lists[] = pim.listPIMLists(PIM.CONTACT_LIST); for (int i = 0; i < lists.length; i++) { //code for custom backup operation if (customCode == 1 && i == 0) { continue; } else if (customCode == 0 && i > 0) { continue; } clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY, lists[i]); Enumeration cenum = clist.items(); while (cenum.hasMoreElements()) { Contact c = (Contact) cenum.nextElement(); ContactDTO contact = new ContactDTO(); parseContactInfo(c, contact); if (customCode == 2 && i > 0) { Enumeration cenum1 = contacts.elements(); ContactDTO contact1; while (cenum1.hasMoreElements()) { contact1 = (ContactDTO) cenum1.nextElement(); if (contact1.getName().equals(contact.getName())) { if (contact1.getCodedString().equals(contact.getCodedString())) { doWrite = false; break; } else { doWrite = true; } } } } if (doWrite) { contacts.addElement(contact); } } clist.close(); } } catch (Exception e) { } } }
[Edit: Removed second part to put as new thread thinking that people may get interest to that too being individual and prominent]

Reply With Quote

