我有问题,我的项目中的getCloudDistance()方法从未被调用,当我使用断点来调试我的项目到达此行query.findInBackground(new FindCallback<ParseObject>() {
然后离开方法并返回到onLoccationChanged()方法!我能做些什么来解决这个问题???!
@Override
public void onLocationChanged(Location location) {
Location net_loc, gps_loc;
gps_loc = location;
while (gps_loc != null) {
showCurrentLocation(gps_loc);
getCloudDistance(location) ;
}
public void getCloudDistance(final Location location) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("ServerBumps");
query.findInBackground(new FindCallback<ParseObject>() {
// @Override
public void done(List<ParseObject> list, com.parse.ParseException e) {
if (e == null) {
for (int i = 0; i < list.size(); ++i) {
Location locationA = new Location("A");
locationA.setLatitude(location.getLatitude());
locationA.setLongitude(location.getLongitude());
/*Location locationA = new Location("A");
locationA.setLatitude(32.3109337);
locationA.setLongitude(35.0284839);
*/
Location locationB = new Location("B");
double lan= Double.parseDouble(list.get(i).getString("Lan"));
double lon=Double.parseDouble(list.get(i).getString("Lon"));
locationB.setLatitude(lan);
locationB.setLongitude(lon);
distance = locationA.distanceTo(locationB);
if (distance <= radius) {
Toast.makeText(MapsActivity.this, "Bump", Toast.LENGTH_LONG).show();
player.start();
}
}
}
}
});
}