-2
我已經創建了FiltersQueryAdapter作爲mainAdapter,它已被傳遞給setupPhotoFilters方法,其中mainadapter被配置爲setAdapter。有可能是因爲parseGeoPointfromLocation不在FiltersQueryApdapter的範圍內,它返回null我在這種情況下做了什麼?NullPointException double getLatitude()
/*
* Helper method to get the Parse GEO point representation of a location
*/
public ParseGeoPoint geoPointFromLocation(Location loc) {
return new ParseGeoPoint(loc.getLatitude(), loc.getLongitude());
}
FiltersQueryAdapter mainAdapter = new FiltersQueryAdapter(this, PhotoFiltersAdapter.class
, new ParseRecyclerQueryAdapter.QueryFactory() {
public ParseQuery create() {
Location myLoc = (currentLocation == null) ? lastLocation : currentLocation;
ParseQuery query = ParseQuery.getQuery("PlaceFilters");
//query.include("user");
query.orderByAscending("GeoArea");
query.whereWithinKilometers("GeoArea", geoPointFromLocation(myLoc), radius);
query.setLimit(6);
return query;
}
});
private void setupPhotoFilters() {
rvFilters.setHasFixedSize(true);
rvFilters.setAdapter(mainAdapter);
rvFilters.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
}
in GeoLocationHelper? –
閱讀錯誤消息。問題出現在TakePhotoActivity.java的第174行。可能是由於GeoLocationHelper沒有將currentBestLocation設置爲任何值而引起的。 – FredK
似乎如果訪問Google Play位置服務的參數設置不正確,就會發生問題。我遵循[本教程](http://developer.android.com/training/location/index.html)在應用程序上設置位置服務。爲我完美工作。讓我知道事情的後續。 –