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

Android™ Runtime Development

Reply
New Contributor
khanh1509
Posts: 4
Registered: ‎08-05-2013
My Device: Z10
Accepted Solution

[CRASH] Crash when using "equals" function of String class

When i use "equals" function of String class to compare 2 strings, the app will crash.

 

Examples : pn_infopush.equals(PN_INFO_TIMER)

 

I have to use "==" instead of "equals". The app will run normarly

 

Does anyone have clue about that ? I don't understand why.

 

Thanks for your support!

Trusted Contributor
imre_m
Posts: 160
Registered: ‎11-17-2010
My Device: PlayBook, Z10, Q10

Re: [CRASH] Crash when using "equals" function of String class

Hi,

 

Is there a chance that your variable can get a null value?

Calling .equals no a null object might cause this.

 

What kind of exception do you get? Can you provide a stacktrace?

--
If you find this post useful please Like it.
If it solves your problem please mark as solution.
New Contributor
khanh1509
Posts: 4
Registered: ‎08-05-2013
My Device: Z10

Re: [CRASH] Crash when using "equals" function of String class

Hi,

 

I have fixed this issue. Thanks for your support.

New Contributor
khanh1509
Posts: 4
Registered: ‎08-05-2013
My Device: Z10

Re: [CRASH] Crash when using "equals" function of String class

1 more question.

How to get stacktrace when running app on BB10 devices?

I use Command Line tool to convert APK to BAR.
Trusted Contributor
imre_m
Posts: 160
Registered: ‎11-17-2010
My Device: PlayBook, Z10, Q10

Re: [CRASH] Crash when using "equals" function of String class

I recommend to launch your application directly from eclipse, then you'll have the full logcat available.

 

From the command line you could try to connect adb manually to the BB device or simulator: adb connect DEVICE_IP:5555

--
If you find this post useful please Like it.
If it solves your problem please mark as solution.
New Contributor
khanh1509
Posts: 4
Registered: ‎08-05-2013
My Device: Z10

Re: [CRASH] Crash when using "equals" function of String class

[ Edited ]

I'have tried but get the error message : "unable to connect to 169.254.0.1:5555" on both simulator and phone

Trusted Contributor
imre_m
Posts: 160
Registered: ‎11-17-2010
My Device: PlayBook, Z10, Q10

Re: [CRASH] Crash when using "equals" function of String class

adb connect from the command line worked for me when I was running eclipse and it already connected to my device.

 

I think you need to have an active connection to the device with blackberry-connect -targetHost <device IP> -devicePassword <password>

But this requires you to set up ssh, generate keys for that etc.

The Eclipse plugin does all of this for you and provides logcat out of the box, so it doesn't really worth the pain to make it work from the command line, unless you need it for other purposes too.

--
If you find this post useful please Like it.
If it solves your problem please mark as solution.