开发者

Nullpointer exception with wifi

开发者 https://www.devze.com 2023-03-03 14:45 出处:网络
I wrote a code which calculates the signal strength of a wifi access points and stores it in an array as shown below.

I wrote a code which calculates the signal strength of a wifi access points and stores it in an array as shown below.

int signallevel = WifiManager.calculateSignalLevel(result.level, 10);
signalStrength开发者_开发百科[i] = signallevel;

I am getting a null pointer exception in line 2.

Can any one please help me out. Thanks in advance


I guess your variable signalStrength is not initialized. You could post a bit more code, too (just to verify the assumption).


Do you have a line like

int[] signalStrength = new int[SOME_SIZE]

If yes, are you sure that SOME_SIZE > i?

0

精彩评论

暂无评论...
验证码 换一张
取 消