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?
精彩评论