Welcome!

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

Reply
Developer
wu7up
Posts: 99
Registered: ‎03-10-2009
My Device: Not Specified
Accepted Solution

PhoneLogs.addListener(this) error

Hi, i have the following code, which is used to add a customized phoneloglistener to the phonelogs.

 

On the 4.3 system or later, everything is fine,

but when I am doing test on 4.1, it seems there is an error on  PhoneLogs.addListener(this);

 

it reports a no instance exception ......, any advice ?

Thanks. 

 

 

 

final class XXXPhoneLogListener implements PhoneLogListener

{

 

public XXXPhoneLogListener ()

{

  try{

    PhoneLogs.addListener(this);

  }

  catch (NullPointerException e)

  { System.out.println(e.getMessage()); }

 

}

 

 

public void callLogAdded(CallLog cl){

 ...

 

 

Developer
wu7up
Posts: 99
Registered: ‎03-10-2009
My Device: Not Specified

Re: PhoneLogs.addListener(this) error

ps. i tested it on the simulator of 4.1, it is fine too.

 

But, when i uploaded it onto a real handheld 7250 with the system 4.10, the error is raised. 

 

I have also uploaded it onto a Curve handheld with the system 4.7.0, everything seems ok. 

 

I need to support the 4.1.0 too, so I have to change the code a little bit. 

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: PhoneLogs.addListener(this) error

I can't see why this code would not work on any device running 4.0 and above. 

 

Was your code compiled on a 4.1 JDE?

 

I'm not familar with the No Instance Exception - can you explain this too me?

Developer
wu7up
Posts: 99
Registered: ‎03-10-2009
My Device: Not Specified

Re: PhoneLogs.addListener(this) error

hi, thanks for the reply.

 

The problem has been solved.

 

It was because there is a security option for accessing the phone log.

 

On the new phone, there will be a prompt asking for permission to access the phone log, but on the old version of blackberry handheld , such as 7250, the prompt doesn't work, even though it is set to be "prompt".

 

Anyway, after setting this option to be "allow", the program works. 

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: PhoneLogs.addListener(this) error

Do you want to mark this as solved then?