我创建了一个简单的应用程序来显示 GPS 传感器卫星信息。信息显示为文本和列表永远不会停止更新相同的重复信息。我如何保留独特的卫星信息?不要重复相同的信息。
public void onGpsStatusChanged() {
GpsStatus gpsStatus = locationManager.getGpsStatus(null);
if(gpsStatus != null) {
Iterable<GpsSatellite>satellites = gpsStatus.getSatellites();
Iterator<GpsSatellite>sat = satellites.iterator();
int i=0;
while (sat.hasNext()) {
GpsSatellite satellite = sat.next();
strGpsStats+= (i++) + ": " + "Pseudo-random number for the satellite: "+satellite.getPrn() + "," + "Satellite was used by the GPS calculation: " + satellite.usedInFix() + "," + "Signal to noise ratio for the satellite: "+satellite.getSnr() + "," + "Azimuth of the satellite in degrees: "+satellite.getAzimuth() + "," +"Elevation of the satellite in degrees: "+satellite.getElevation()+ "\n\n";
}
Satinfos.setText(strGpsStats);
}
}