Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _
Accepted Solution

Delete all call log programmatically

I am deleting the all call log(Normal & Missed) but getting ArrayIndexofBoundException.


try {
            PhoneLogs phnl = PhoneLogs.getInstance();
            int normalCount = phnl.numberOfCalls(PhoneLogs.FOLDER_NORMAL_CALLS);
            for (int a = 0; a < normalCount; a++) {
                phnl.deleteCall(a, PhoneLogs.FOLDER_NORMAL_CALLS);  <<HERE Getting Exception
            normalCount = phnl.numberOfCalls(PhoneLogs.FOLDER_MISSED_CALLS);
            for (int a = 0; a < normalCount; a++) {
                phnl.deleteCall(a, PhoneLogs.FOLDER_MISSED_CALLS);
        } catch (Exception e) {
            System.out.print("Exception arises" + e.toString());


Can you please help me in this to solve this.


Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Delete all call log programmatically

my guess would be that the size of the phonelogs shrinks when you delete an object, iterate from the upper border down.
(int a = count-1, a > -<, a--)
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 217
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2

Re: Delete all call log programmatically

for (int a = 0; a < normalCount; a++) {
    phnl.deleteCall(0, PhoneLogs.FOLDER_NORMAL_CALLS);

Everytime deletes the first call log.