Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2007

    Cannot remove PIM Event - Solved!!


    I have followed numerous examples of the PIM API for adding and removing events. However, while I can add new events without any problems, I cannot remove the added events.

    The error message I get on my Nokia 6131 phone is "the item does not belong to the list". I have tried to google this message, but have not found any solution for it.

    This is were the error occurs :

    public void removePIMEvent(final int index) {
    		new Thread(new Runnable() {
    			 public void run() {
    				 Event ev = null;
    				 synchronized (PIMManager.this) {
    						 try {
    							 ev = (Event)itemList.elementAt(index);
    						 catch (PIMException e) {
    							 midlet.error("Cannot remove event.\n"+e.getMessage());
    Thanks for any advice.
    Last edited by Dervis; 2008-05-03 at 13:16.

  2. #2
    Registered User
    Join Date
    Apr 2008

    Re: Cannot remove PIM Event

    I am not familiar with the PIM API but my guess would be that the error is occuring at:
    ev = (Event)itemList.elementAt(index);
    I believe this problem might occur because of one of these two reasons:
    - the variable index is not correct (probably because it's not thread safe). Where do you increment or decrement the value of index and do you take care of thread concurrency?
    // index initially 10
    ev = (Event)itemList.elementAt(index); // no element in position 10, error is thrown
    - PIMManager.this is not ensuring thread safety. The following can happen. Assume you have two threads A & B running:
    // index = 0 initially
    A: ev = (Event)itemList.elementAt(index); // gets element X
    A: events.removeEvent(ev);
    A: itemList.removeAllElements();  // all items removed
    B: ev = (Event)itemList.elementAt(index); // no items in itemList, error is thrown
    Hope this helps

  3. #3
    Registered User
    Join Date
    Dec 2007

    Re: Cannot remove PIM Event - Solved!!


    After hours and hours of searching, I have finally found the error.

    The error is thrown because I initialized the PIMList several times, without closing and cleaning the resources correctly. In my class called "PIMManager", I now load the EventList only ones.

Similar Threads

  1. Help me for touch Screen Event Handling
    By nil.bagul in forum Mobile Java General
    Replies: 1
    Last Post: 2008-03-28, 11:22
  2. PIM API event
    By rylagrace in forum Mobile Java General
    Replies: 0
    Last Post: 2008-03-05, 04:05
  3. CLogEvent problem
    By silviuccia in forum Symbian
    Replies: 2
    Last Post: 2006-12-22, 15:28
  4. Replies: 0
    Last Post: 2006-04-27, 15:21
  5. PIM API Again
    By cars2004 in forum Mobile Java General
    Replies: 1
    Last Post: 2005-02-23, 14:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts