好吧,我也有同样的麻烦!CellInfo 为空,因为我们没有放任何东西。所以我试着帮助听众一点。我强迫他让 .getAllCellInfo 进入监听器。这对我有用。
class MyPhoneStateListener extends PhoneStateListener
{
int signal;
String cellList;
@Override
public void onCellInfoChanged(List<CellInfo> cellInfo)
{
super.onCellInfoChanged(cellInfo);
cellInfo = Tel.getAllCellInfo();
if (cellInfo!=null)
cellList = cellInfo.toString();
else cellList="ni mierda";
mSignalStrengthView.append("" + String.valueOf(cellList));
}
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength)
{
super.onSignalStrengthsChanged(signalStrength);
signal = signalStrength.getGsmSignalStrength()*2-113;
mSignalStrengthView.append("GSM signal strength is " + String.valueOf(this.signal));
}
}