开发者

Nullpointer exception with wifi

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜