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
Highlighted
Contributor
Posts: 27
Registered: ‎01-21-2011
My Device: Bold 9900
My Carrier: Cellcom

PhoneCall API is missing a return case

Hey,

 

I read the above API and I would like to know what will getPhoneNumber() method will return if the phone number associated with this phone call is private or unknown?

Will it always return empty string?

 

I think it will be nice to mention it in the API.

 

Thanks,

Rotem

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: PhoneCall API is missing a return case

good question, i cannot recall, but quite easy to test it yourself, isn't it?
----------------------------------------------------------
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
Contributor
Posts: 27
Registered: ‎01-21-2011
My Device: Bold 9900
My Carrier: Cellcom

Re: PhoneCall API is missing a return case

[ Edited ]

Hi,

 

I tried to test it myself for hours..

When I used the simulator it returned 'Anonymous-'[call index] (1,2,etc..) .

When I used my real device it returned nothing, altough when I compared the returned string to empty string it wasn't true.

 

This is the code I used:

number = Phone.getCall(callId).getPhoneNumber();
String txt;

if( number.indexOf("Anonymous") == -1 )
txt = number;
else if( number == null )
txt = "null";
else if( number.equals("") )
txt = "empty";
else
txt = "Private or Unknown";

numLbl = new LabelField( "*" + txt + "*" )

 

More ideas?

 

Thanks,

Rotem