Manipulation of the Phonlog but without success in removing an element

Hello

I wrote a small application that needs to manipulate the last entry in the phonelog. I want to replace the number dialed by a custom filter. Only the custom number must be in the newspaper. Writing number custom works very good journal but by removing the number dialed does not work. I read in another thread that der had a problem with the removal of items phonlog in v4.2. I develop on version 4.5 fact that the problem persists or I did something wrong (see list below).

import java.util.Vector;import net.rim.blackberry.api.phone.phonelogs.CallLog;import net.rim.blackberry.api.phone.phonelogs.PhoneCallLog;import net.rim.blackberry.api.phone.phonelogs.PhoneCallLogID;import net.rim.blackberry.api.phone.phonelogs.PhoneLogs;import net.rim.device.api.system.PersistentStore;import net.rim.device.api.util.StringMatch;

public class PhoneLogListener implements     net.rim.blackberry.api.phone.phonelogs.PhoneLogListener {

  private AsteriskMenuItem caller;  private boolean editFlag = false;

   public PhoneLogListener (AsteriskMenuItem theMenuItem)    {     caller = theMenuItem; }

  public void callLogAdded(CallLog cl) {

          PhoneCallLog myLog = ((PhoneCallLog)cl);

          //get ne number to be write in the log            String participantNumber =  (myLog.getParticipant()).getNumber();         //get the current service number from the persistent store (String)           Vector persStore  = (Vector) (PersistentStore.getPersistentObject( 0xd4b6b5eeea339daL )).getContents();           String currentServiceNumber = (String)persStore.firstElement();

          //if the participantnumber starts with the servicenumber we did come from the application and want to edit the logentry           if (participantNumber.startsWith(currentServiceNumber));          {             //set the number we want to show                                myLog.setParticipant(new PhoneCallLogID(caller.getPhoneNumber2()));

                                //remove the listener to prevent an endless loop                PhoneLogs.removeListener(this);

                                //---> the folowing does not work                    //(PhoneLogs.getInstance()).deleteCall(0, PhoneLogs.FOLDER_NORMAL_CALLS);             //---> the folowing works                                (PhoneLogs.getInstance()).addCall(myLog);           }

   }

 public void callLogRemoved(CallLog cl) {      // TODO Auto-generated method stub

  }

   public void callLogUpdated(CallLog cl, CallLog oldCl) {       // TODO Auto-generated method stub

  }

   public void reset() {     // TODO Auto-generated method stub

  }

}

The invokeLater proved to be crucial for my scenario.

You can learn more here:

http://tinyurl.com/dlg36t

Or search through the forums.

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for